Skip to content
Bitcoin Roots

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. The two line-number columns refer to before and after.

src/node/miner.h CHANGED
@@ -16,6 +16,7 @@
16
16
  #include <cstdint>
17
17
  #include <memory>
18
18
  #include <optional>
19
+ #include <set>
19
20
 
20
21
  #include <boost/multi_index/identity.hpp>
21
22
  #include <boost/multi_index/indexed_by.hpp>
@@ -65,6 +66,8 @@ private:
65
66
 
66
67
  // Information on the current status of the block
67
68
  uint64_t nBlockWeight;
69
+ uint64_t nBlockSize;
70
+ std::set<const CTxMemPoolEntry*> m_in_block;
68
71
  uint64_t nBlockTx;
69
72
  uint64_t nBlockSigOpsCost;
70
73
  CAmount nFees;
@@ -81,6 +84,8 @@ public:
81
84
  struct Options : BlockCreateOptions {
82
85
  // Configuration parameters for the block size
83
86
  size_t nBlockMaxWeight{DEFAULT_BLOCK_MAX_WEIGHT};
87
+ size_t nBlockMaxSize{MAX_BLOCK_SERIALIZED_SIZE};
88
+ size_t nBlockPrioritySize{DEFAULT_BLOCK_PRIORITY_SIZE};
84
89
  CFeeRate blockMinFeeRate{DEFAULT_BLOCK_MIN_TX_FEE};
85
90
  // Whether to call TestBlockValidity() at the end of CreateNewBlock().
86
91
  bool test_block_validity{true};
@@ -111,11 +116,12 @@ private:
111
116
  *
112
117
  * @pre BlockAssembler::m_mempool must not be nullptr
113
118
  */
119
+ void addPriorityTxs() EXCLUSIVE_LOCKS_REQUIRED(::cs_main, m_mempool->cs);
114
120
  void addChunks() EXCLUSIVE_LOCKS_REQUIRED(m_mempool->cs);
115
121
 
116
122
  // helper functions for addChunks()
117
123
  /** Test if a new chunk would "fit" in the block */
118
- bool TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost) const;
124
+ bool TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost, uint64_t chunk_size) const;
119
125
  /** Perform locktime checks on each transaction in a chunk:
120
126
  * This check should always succeed, and is here
121
127
  * only as an extra check in case of a bug */
@@ -134,7 +140,7 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam
134
140
  /** Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed */
135
141
  void RegenerateCommitments(CBlock& block, ChainstateManager& chainman);
136
142
 
137
- /** Apply -blockmintxfee and -blockmaxweight options from ArgsManager to BlockAssembler options. */
143
+ /** Apply local size, weight, priority, reserve and fee options. */
138
144
  void ApplyArgsManOptions(const ArgsManager& gArgs, BlockAssembler::Options& options);
139
145
 
140
146
  /* Compute the block's merkle root, insert or replace the coinbase transaction and the merkle root into the block */