mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
refactor: Convert ChainstateRole enum to struct
Change ChainstateRole parameter passed to wallets and indexes. Wallets and indexes need to know whether chainstate is historical and whether it is fully validated. They should not be aware of the assumeutxo snapshot validation process.
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
|
||||
#include <chain.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <kernel/chain.h>
|
||||
#include <kernel/mempool_entry.h>
|
||||
#include <kernel/mempool_removal_reason.h>
|
||||
#include <kernel/types.h>
|
||||
#include <logging.h>
|
||||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
using kernel::ChainstateRole;
|
||||
|
||||
/**
|
||||
* ValidationSignalsImpl manages a list of shared_ptr<CValidationInterface> callbacks.
|
||||
*
|
||||
@@ -209,7 +211,8 @@ void ValidationSignals::TransactionRemovedFromMempool(const CTransactionRef& tx,
|
||||
RemovalReasonToString(reason));
|
||||
}
|
||||
|
||||
void ValidationSignals::BlockConnected(ChainstateRole role, const std::shared_ptr<const CBlock> &pblock, const CBlockIndex *pindex) {
|
||||
void ValidationSignals::BlockConnected(const ChainstateRole& role, const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex)
|
||||
{
|
||||
auto event = [role, pblock, pindex, this] {
|
||||
m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.BlockConnected(role, pblock, pindex); });
|
||||
};
|
||||
@@ -238,7 +241,8 @@ void ValidationSignals::BlockDisconnected(const std::shared_ptr<const CBlock>& p
|
||||
pindex->nHeight);
|
||||
}
|
||||
|
||||
void ValidationSignals::ChainStateFlushed(ChainstateRole role, const CBlockLocator &locator) {
|
||||
void ValidationSignals::ChainStateFlushed(const ChainstateRole& role, const CBlockLocator& locator)
|
||||
{
|
||||
auto event = [role, locator, this] {
|
||||
m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.ChainStateFlushed(role, locator); });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user