mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 09:43:55 +02:00
refactor: Move functions to BlockManager methods
This is a commit in preparation for the next few commits. The functions are moved to methods to avoid their re-declaration for the purpose of passing in BlockManager options. The functions that were now moved into the BlockManager should no longer use the params as an argument, but instead use the member variable. In the moved ReadBlockFromDisk and UndoReadFromDisk, change the function signature to accept a reference to a CBlockIndex instead of a raw pointer. The pointer is expected to be non-null, so reflect that in the type. To allow for the move of functions to BlockManager methods all call sites require an instantiated BlockManager, or a callback to one.
This commit is contained in:
@@ -16,6 +16,7 @@ struct Params;
|
||||
}
|
||||
|
||||
namespace node {
|
||||
class BlockManager;
|
||||
struct NodeContext;
|
||||
|
||||
/** Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls.
|
||||
@@ -53,11 +54,10 @@ static const CFeeRate DEFAULT_MAX_RAW_TX_FEE_RATE{COIN / 10};
|
||||
* @param[in] block_index The block to read from disk, or nullptr
|
||||
* @param[in] mempool If provided, check mempool for tx
|
||||
* @param[in] hash The txid
|
||||
* @param[in] consensusParams The params
|
||||
* @param[out] hashBlock The block hash, if the tx was found via -txindex or block_index
|
||||
* @returns The tx if found, otherwise nullptr
|
||||
*/
|
||||
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock);
|
||||
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, uint256& hashBlock, const BlockManager& blockman);
|
||||
} // namespace node
|
||||
|
||||
#endif // BITCOIN_NODE_TRANSACTION_H
|
||||
|
||||
Reference in New Issue
Block a user