mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 17:30:25 +01:00
Merge bitcoin/bitcoin#31196: Prune mining interface
c991cea1a0Remove processNewBlock() from mining interface (Sjors Provoost)9a47852d88Remove getTransactionsUpdated() from mining interface (Sjors Provoost)bfc4e029d4Remove testBlockValidity() from mining interface (Sjors Provoost) Pull request description: There are three methods in the mining interface that can be dropped. The Template Provider doesn't need them and other application should probably not use them either. 1. `processNewBlock()` was added in7b4d3249ce, but became unnecessary with the introduction of interfaces::BlockTemplate::submitSolution in7b4d3249ce. Dropping it was suggested in https://github.com/bitcoin/bitcoin/pull/30200#issuecomment-2404460342 2. `getTransactionsUpdated()`: this is used in the implementation of #31003 `waitFeesChanged`. It's not very useful generically because the mempool updates very frequently. 3. `testBlockValidity()`: it might be useful for mining application to have a way to check the validity of a block template they modified, but the Stratum v2 Template Provider doesn't do that, and this method is a bit brittle (e.g. the block needs to build on the tip). ACKs for top commit: TheCharlatan: Re-ACKc991cea1a0ryanofsky: Code review ACKc991cea1a0. Since last review, just rebased to avoid conflicts in surrounding code, and edited a commit message tdb3: code review ACKc991cea1a0Tree-SHA512: 2138e54f920b26e01c068b24498c6a210c5c4358138dce0702ab58185d9ae148a18f04c97ac9f043646d40f8031618d80a718a176b1ce4779c237de6fb9c4a67
This commit is contained in:
@@ -979,29 +979,6 @@ public:
|
||||
return BlockRef{chainman().ActiveChain().Tip()->GetBlockHash(), chainman().ActiveChain().Tip()->nHeight};
|
||||
}
|
||||
|
||||
bool processNewBlock(const std::shared_ptr<const CBlock>& block, bool* new_block) override
|
||||
{
|
||||
return chainman().ProcessNewBlock(block, /*force_processing=*/true, /*min_pow_checked=*/true, /*new_block=*/new_block);
|
||||
}
|
||||
|
||||
unsigned int getTransactionsUpdated() override
|
||||
{
|
||||
return context()->mempool->GetTransactionsUpdated();
|
||||
}
|
||||
|
||||
bool testBlockValidity(const CBlock& block, bool check_merkle_root, BlockValidationState& state) override
|
||||
{
|
||||
LOCK(cs_main);
|
||||
CBlockIndex* tip{chainman().ActiveChain().Tip()};
|
||||
// Fail if the tip updated before the lock was taken
|
||||
if (block.hashPrevBlock != tip->GetBlockHash()) {
|
||||
state.Error("Block does not connect to current chain tip.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return TestBlockValidity(state, chainman().GetParams(), chainman().ActiveChainstate(), block, tip, /*fCheckPOW=*/false, check_merkle_root);
|
||||
}
|
||||
|
||||
std::unique_ptr<BlockTemplate> createNewBlock(const BlockCreateOptions& options) override
|
||||
{
|
||||
BlockAssembler::Options assemble_options{options};
|
||||
|
||||
Reference in New Issue
Block a user