mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 08:13:52 +02:00
validation: pass ChainstateRole for validationinterface calls
This allows consumers to decide how to handle events from background or assumedvalid chainstates.
This commit is contained in:
committed by
James O'Beirne
parent
1e59acdf17
commit
4d8f4dcb45
@@ -105,7 +105,7 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_unclean_shutdown, TestChain100Setup)
|
||||
// Send block connected notification, then stop the index without
|
||||
// sending a chainstate flushed notification. Prior to #24138, this
|
||||
// would cause the index to be corrupted and fail to reload.
|
||||
ValidationInterfaceTest::BlockConnected(index, new_block, new_block_index);
|
||||
ValidationInterfaceTest::BlockConnected(ChainstateRole::NORMAL, index, new_block, new_block_index);
|
||||
index.Stop();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,11 @@ void TestChainstateManager::JumpOutOfIbd()
|
||||
Assert(!IsInitialBlockDownload());
|
||||
}
|
||||
|
||||
void ValidationInterfaceTest::BlockConnected(CValidationInterface& obj, const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex)
|
||||
void ValidationInterfaceTest::BlockConnected(
|
||||
ChainstateRole role,
|
||||
CValidationInterface& obj,
|
||||
const std::shared_ptr<const CBlock>& block,
|
||||
const CBlockIndex* pindex)
|
||||
{
|
||||
obj.BlockConnected(block, pindex);
|
||||
obj.BlockConnected(role, block, pindex);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,11 @@ struct TestChainstateManager : public ChainstateManager {
|
||||
class ValidationInterfaceTest
|
||||
{
|
||||
public:
|
||||
static void BlockConnected(CValidationInterface& obj, const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex);
|
||||
static void BlockConnected(
|
||||
ChainstateRole role,
|
||||
CValidationInterface& obj,
|
||||
const std::shared_ptr<const CBlock>& block,
|
||||
const CBlockIndex* pindex);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_TEST_UTIL_VALIDATION_H
|
||||
|
||||
@@ -43,7 +43,7 @@ struct TestSubscriber final : public CValidationInterface {
|
||||
BOOST_CHECK_EQUAL(m_expected_tip, pindexNew->GetBlockHash());
|
||||
}
|
||||
|
||||
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex) override
|
||||
void BlockConnected(ChainstateRole role, const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex) override
|
||||
{
|
||||
BOOST_CHECK_EQUAL(m_expected_tip, block->hashPrevBlock);
|
||||
BOOST_CHECK_EQUAL(m_expected_tip, pindex->pprev->GetBlockHash());
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <scheduler.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/check.h>
|
||||
#include <kernel/chain.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
Reference in New Issue
Block a user