mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-05 11:28:49 +02:00
Merge bitcoin/bitcoin#31910: qa: fix an off-by-one in utxo snapshot fuzz target and sanity check its snapshot data
63b534f97efuzz: sanity check hardcoded snapshot in utxo_snapshot target (Antoine Poinsot)3b85eba83atest util: split up ConnectBlock from MineBlock (Antoine Poinsot)d1527f6b88qa: correct off-by-one in utxo snapshot fuzz target (Antoine Poinsot) Pull request description: The assumeutxo data for the fuzz target could change and invalidate the hash silently, preventing the fuzz target from reaching some code paths. Fix this by introducing a unit test which would break if the snapshot data the fuzz target relies on were to change. In implementing this i noticed the height used for coins in the fuzz target is actually off-by-one (as if the first block in the created chain was the genesis but it's block `1`), so fix that too. ACKs for top commit: mzumsande: Code Review ACK63b534f97efjahr: tACK63b534f97eTree-SHA512: 2399b6e74db9b78aab8efba67c57a405d2d7d880ae3b7d8518a1c96cc6266f61f5e77722cd999adeac5d3e03e73d84cf9ae7bdbcc0afae198cc87049dde4012f
This commit is contained in:
@@ -92,6 +92,11 @@ COutPoint MineBlock(const NodeContext& node, std::shared_ptr<CBlock>& block)
|
||||
assert(block->nNonce);
|
||||
}
|
||||
|
||||
return ProcessBlock(node, block);
|
||||
}
|
||||
|
||||
COutPoint ProcessBlock(const NodeContext& node, const std::shared_ptr<CBlock>& block)
|
||||
{
|
||||
auto& chainman{*Assert(node.chainman)};
|
||||
const auto old_height = WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight());
|
||||
bool new_block;
|
||||
|
||||
@@ -32,6 +32,11 @@ COutPoint MineBlock(const node::NodeContext&,
|
||||
**/
|
||||
COutPoint MineBlock(const node::NodeContext&, std::shared_ptr<CBlock>& block);
|
||||
|
||||
/**
|
||||
* Returns the generated coin (or Null if the block was invalid).
|
||||
*/
|
||||
COutPoint ProcessBlock(const node::NodeContext&, const std::shared_ptr<CBlock>& block);
|
||||
|
||||
/** Prepare a block to be mined */
|
||||
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext&);
|
||||
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext& node,
|
||||
|
||||
Reference in New Issue
Block a user