Skip to content

Commit 75ce763

Browse files
committed
refactor: testBlockValidity make out argument last
1 parent 83a9bef commit 75ce763

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/interfaces/mining.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Mining
4545
* @returns a block template
4646
*/
4747
virtual std::unique_ptr<node::CBlockTemplate> createNewBlock(const CScript& script_pub_key, bool use_mempool = true) = 0;
48+
4849
/**
4950
* Processes new block. A valid new block is automatically relayed to peers.
5051
*
@@ -63,12 +64,12 @@ class Mining
6364
* Only works on top of our current best block.
6465
* Does not check proof-of-work.
6566
*
66-
* @param[out] state details of why a block failed to validate
6767
* @param[in] block the block to validate
6868
* @param[in] check_merkle_root call CheckMerkleRoot()
69+
* @param[out] state details of why a block failed to validate
6970
* @returns false if any of the checks fail
7071
*/
71-
virtual bool testBlockValidity(BlockValidationState& state, const CBlock& block, bool check_merkle_root = true) = 0;
72+
virtual bool testBlockValidity(const CBlock& block, bool check_merkle_root, BlockValidationState& state) = 0;
7273

7374
//! Get internal node context. Useful for RPC and testing,
7475
//! but not accessible across processes.

src/node/interfaces.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ class MinerImpl : public Mining
870870
return context()->mempool->GetTransactionsUpdated();
871871
}
872872

873-
bool testBlockValidity(BlockValidationState& state, const CBlock& block, bool check_merkle_root) override
873+
bool testBlockValidity(const CBlock& block, bool check_merkle_root, BlockValidationState& state) override
874874
{
875875
LOCK(::cs_main);
876876
return TestBlockValidity(state, chainman().GetParams(), chainman().ActiveChainstate(), block, chainman().ActiveChain().Tip(), /*fCheckPOW=*/false, check_merkle_root);

src/rpc/mining.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static RPCHelpMan generateblock()
390390
LOCK(cs_main);
391391

392392
BlockValidationState state;
393-
if (!miner.testBlockValidity(state, block, /*check_merkle_root=*/false)) {
393+
if (!miner.testBlockValidity(block, /*check_merkle_root=*/false, state)) {
394394
throw JSONRPCError(RPC_VERIFY_ERROR, strprintf("testBlockValidity failed: %s", state.ToString()));
395395
}
396396
}
@@ -713,7 +713,7 @@ static RPCHelpMan getblocktemplate()
713713
return "inconclusive-not-best-prevblk";
714714
}
715715
BlockValidationState state;
716-
miner.testBlockValidity(state, block);
716+
miner.testBlockValidity(block, /*check_merkle_root=*/true, state);
717717
return BIP22ValidationResult(state);
718718
}
719719

0 commit comments

Comments
 (0)