mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge bitcoin/bitcoin#25168: refactor: Avoid passing params where not needed
fa1b76aeb0Do not call global Params() when chainman is in scope (MacroFake)fa30234be8Do not pass CChainParams& to PeerManager::make (MacroFake)fafe5c0ca2Do not pass CChainParams& to BlockAssembler constructor (MacroFake)faf012b438Do not pass Consensus::Params& to Chainstate helpers (MacroFake)fa4ee53dcaDo not pass time getter to Chainstate helpers (MacroFake) Pull request description: It seems confusing to pass chain params, consensus params, or a time function around when it is not needed. Fix this by: * Inlining the passed time getter function. I don't see a use case why this should be mockable. * Using `chainman.GetConsensus()` or `chainman.GetParams()`, where possible. ACKs for top commit: promag: Code review ACKfa1b76aeb0. vincenzopalazzo: ACKfa1b76aeb0Tree-SHA512: 1abff5cba4b4871d97f17dbcdf67bc9255ff21fa4150a79a74e39b28f0610eab3e7dee24d56872dd6e111f003b55e288958cdd467e6218368d896f191e4ec9cd
This commit is contained in:
@@ -217,7 +217,7 @@ static RPCHelpMan getrawtransaction()
|
||||
uint256 hash = ParseHashV(request.params[0], "parameter 1");
|
||||
const CBlockIndex* blockindex = nullptr;
|
||||
|
||||
if (hash == Params().GenesisBlock().hashMerkleRoot) {
|
||||
if (hash == chainman.GetParams().GenesisBlock().hashMerkleRoot) {
|
||||
// Special exception for the genesis block coinbase transaction
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "The genesis block coinbase is not considered an ordinary transaction and cannot be retrieved");
|
||||
}
|
||||
@@ -245,7 +245,7 @@ static RPCHelpMan getrawtransaction()
|
||||
}
|
||||
|
||||
uint256 hash_block;
|
||||
const CTransactionRef tx = GetTransaction(blockindex, node.mempool.get(), hash, Params().GetConsensus(), hash_block);
|
||||
const CTransactionRef tx = GetTransaction(blockindex, node.mempool.get(), hash, chainman.GetConsensus(), hash_block);
|
||||
if (!tx) {
|
||||
std::string errmsg;
|
||||
if (blockindex) {
|
||||
|
||||
Reference in New Issue
Block a user