v31.1-roots.1 · Commit 4: [PATCH 04/17] feat(mining): preserve Roots priority and template policies
src/node/miner.h
Before: src/node/miner.h · After: src/node/miner.h
File metadata
index 5c8668771f5997d77fe28d1e423d63b7349d476d..adafe44073214bb3ab01c01e826477912f4986f8 100644
Download original patch · Release notes
Diff rows 1–44 of 44. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/node/miner.h
CHANGED
|
@@ -16,6 +16,7 @@
|
|
| 16 |
#include <cstdint>
|
| 17 |
#include <memory>
|
| 18 |
#include <optional>
|
|
|
|
| 19 |
|
| 20 |
#include <boost/multi_index/identity.hpp>
|
| 21 |
#include <boost/multi_index/indexed_by.hpp>
|
|
@@ -65,6 +66,8 @@ private:
|
|
| 65 |
|
| 66 |
// Information on the current status of the block
|
| 67 |
uint64_t nBlockWeight;
|
|
|
|
|
|
|
| 68 |
uint64_t nBlockTx;
|
| 69 |
uint64_t nBlockSigOpsCost;
|
| 70 |
CAmount nFees;
|
|
@@ -81,6 +84,8 @@ public:
|
|
| 81 |
struct Options : BlockCreateOptions {
|
| 82 |
// Configuration parameters for the block size
|
| 83 |
size_t nBlockMaxWeight{DEFAULT_BLOCK_MAX_WEIGHT};
|
|
|
|
|
|
|
| 84 |
CFeeRate blockMinFeeRate{DEFAULT_BLOCK_MIN_TX_FEE};
|
| 85 |
// Whether to call TestBlockValidity() at the end of CreateNewBlock().
|
| 86 |
bool test_block_validity{true};
|
|
@@ -111,11 +116,12 @@ private:
|
|
| 111 |
*
|
| 112 |
* @pre BlockAssembler::m_mempool must not be nullptr
|
| 113 |
*/
|
|
|
|
| 114 |
void addChunks() EXCLUSIVE_LOCKS_REQUIRED(m_mempool->cs);
|
| 115 |
|
| 116 |
// helper functions for addChunks()
|
| 117 |
/** Test if a new chunk would "fit" in the block */
|
| 118 |
-
bool TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost) const;
|
| 119 |
/** Perform locktime checks on each transaction in a chunk:
|
| 120 |
* This check should always succeed, and is here
|
| 121 |
* only as an extra check in case of a bug */
|
|
@@ -134,7 +140,7 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam
|
|
| 134 |
/** Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed */
|
| 135 |
void RegenerateCommitments(CBlock& block, ChainstateManager& chainman);
|
| 136 |
|
| 137 |
-
/** Apply -blockmintxfee and -blockmaxweight options from ArgsManager to BlockAssembler options. */
|
| 138 |
void ApplyArgsManOptions(const ArgsManager& gArgs, BlockAssembler::Options& options);
|
| 139 |
|
| 140 |
/* Compute the block's merkle root, insert or replace the coinbase transaction and the merkle root into the block */
|
|
|
|
| 16 |
#include <cstdint>
|
| 17 |
#include <memory>
|
| 18 |
#include <optional>
|
| 19 |
+
#include <set>
|
| 20 |
|
| 21 |
#include <boost/multi_index/identity.hpp>
|
| 22 |
#include <boost/multi_index/indexed_by.hpp>
|
|
|
|
| 66 |
|
| 67 |
// Information on the current status of the block
|
| 68 |
uint64_t nBlockWeight;
|
| 69 |
+
uint64_t nBlockSize;
|
| 70 |
+
std::set<const CTxMemPoolEntry*> m_in_block;
|
| 71 |
uint64_t nBlockTx;
|
| 72 |
uint64_t nBlockSigOpsCost;
|
| 73 |
CAmount nFees;
|
|
|
|
| 84 |
struct Options : BlockCreateOptions {
|
| 85 |
// Configuration parameters for the block size
|
| 86 |
size_t nBlockMaxWeight{DEFAULT_BLOCK_MAX_WEIGHT};
|
| 87 |
+
size_t nBlockMaxSize{MAX_BLOCK_SERIALIZED_SIZE};
|
| 88 |
+
size_t nBlockPrioritySize{DEFAULT_BLOCK_PRIORITY_SIZE};
|
| 89 |
CFeeRate blockMinFeeRate{DEFAULT_BLOCK_MIN_TX_FEE};
|
| 90 |
// Whether to call TestBlockValidity() at the end of CreateNewBlock().
|
| 91 |
bool test_block_validity{true};
|
|
|
|
| 116 |
*
|
| 117 |
* @pre BlockAssembler::m_mempool must not be nullptr
|
| 118 |
*/
|
| 119 |
+
void addPriorityTxs() EXCLUSIVE_LOCKS_REQUIRED(::cs_main, m_mempool->cs);
|
| 120 |
void addChunks() EXCLUSIVE_LOCKS_REQUIRED(m_mempool->cs);
|
| 121 |
|
| 122 |
// helper functions for addChunks()
|
| 123 |
/** Test if a new chunk would "fit" in the block */
|
| 124 |
+
bool TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost, uint64_t chunk_size) const;
|
| 125 |
/** Perform locktime checks on each transaction in a chunk:
|
| 126 |
* This check should always succeed, and is here
|
| 127 |
* only as an extra check in case of a bug */
|
|
|
|
| 140 |
/** Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed */
|
| 141 |
void RegenerateCommitments(CBlock& block, ChainstateManager& chainman);
|
| 142 |
|
| 143 |
+
/** Apply local size, weight, priority, reserve and fee options. */
|
| 144 |
void ApplyArgsManOptions(const ArgsManager& gArgs, BlockAssembler::Options& options);
|
| 145 |
|
| 146 |
/* Compute the block's merkle root, insert or replace the coinbase transaction and the merkle root into the block */
|