mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 05:22:30 +02:00

When generating a block template through e.g. getblocktemplate RPC, we reserve 4000 weight units and 400 sigops. Pools use this space for their coinbase outputs. At least one pool patched their Bitcoin Core node to adjust these hardcoded values. They eventually produced an invalid block which exceeded the sigops limit. https://bitcoin.stackexchange.com/questions/117837/how-many-sigops-are-in-the-invalid-block-783426 The existince of such patches suggests it may be useful to make this value configurable. This commit would make such a change easier. The main motivation however is that the Stratum v2 spec requires the pool to communicate the maximum bytes they intend to add to the coinbase outputs. A proposed change to the spec would also require them to communicate the maximum number of sigops. This commit also documents what happens when -blockmaxweight is lower than the coinbase reserved value. Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
// Copyright (c) 2010-2021 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
//! @file node/types.h is a home for public enum and struct type definitions
|
|
//! that are used by internally by node code, but also used externally by wallet
|
|
//! or GUI code.
|
|
//!
|
|
//! This file is intended to define only simple types that do not have external
|
|
//! dependencies. More complicated types should be defined in dedicated header
|
|
//! files.
|
|
|
|
#ifndef BITCOIN_NODE_TYPES_H
|
|
#define BITCOIN_NODE_TYPES_H
|
|
|
|
#include <cstddef>
|
|
|
|
namespace node {
|
|
enum class TransactionError {
|
|
OK, //!< No error
|
|
MISSING_INPUTS,
|
|
ALREADY_IN_CHAIN,
|
|
MEMPOOL_REJECTED,
|
|
MEMPOOL_ERROR,
|
|
MAX_FEE_EXCEEDED,
|
|
MAX_BURN_EXCEEDED,
|
|
INVALID_PACKAGE,
|
|
};
|
|
|
|
struct BlockCreateOptions {
|
|
/**
|
|
* Set false to omit mempool transactions
|
|
*/
|
|
bool use_mempool{true};
|
|
/**
|
|
* The maximum additional weight which the pool will add to the coinbase
|
|
* scriptSig, witness and outputs. This must include any additional
|
|
* weight needed for larger CompactSize encoded lengths.
|
|
*/
|
|
size_t coinbase_max_additional_weight{4000};
|
|
/**
|
|
* The maximum additional sigops which the pool will add in coinbase
|
|
* transaction outputs.
|
|
*/
|
|
size_t coinbase_output_max_additional_sigops{400};
|
|
};
|
|
} // namespace node
|
|
|
|
#endif // BITCOIN_NODE_TYPES_H
|