mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +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:
@@ -22,7 +22,7 @@
|
||||
#include <flatfile.h>
|
||||
#include <headerssync.h>
|
||||
#include <index/blockfilterindex.h>
|
||||
#include <kernel/chain.h>
|
||||
#include <kernel/types.h>
|
||||
#include <logging.h>
|
||||
#include <merkleblock.h>
|
||||
#include <net.h>
|
||||
@@ -85,6 +85,7 @@
|
||||
#include <typeinfo>
|
||||
#include <utility>
|
||||
|
||||
using kernel::ChainstateRole;
|
||||
using namespace util::hex_literals;
|
||||
|
||||
TRACEPOINT_SEMAPHORE(net, inbound_message);
|
||||
@@ -507,7 +508,7 @@ public:
|
||||
/** Overridden from CValidationInterface. */
|
||||
void ActiveTipChange(const CBlockIndex& new_tip, bool) override
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
||||
void BlockConnected(ChainstateRole role, const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override
|
||||
void BlockConnected(const ChainstateRole& role, const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
||||
void BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex) override
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
||||
@@ -1946,7 +1947,7 @@ void PeerManagerImpl::ActiveTipChange(const CBlockIndex& new_tip, bool is_ibd)
|
||||
* possibly reduce dynamic block stalling timeout.
|
||||
*/
|
||||
void PeerManagerImpl::BlockConnected(
|
||||
ChainstateRole role,
|
||||
const ChainstateRole& role,
|
||||
const std::shared_ptr<const CBlock>& pblock,
|
||||
const CBlockIndex* pindex)
|
||||
{
|
||||
@@ -1965,8 +1966,8 @@ void PeerManagerImpl::BlockConnected(
|
||||
}
|
||||
|
||||
// The following task can be skipped since we don't maintain a mempool for
|
||||
// the ibd/background chainstate.
|
||||
if (role == ChainstateRole::BACKGROUND) {
|
||||
// the historical chainstate.
|
||||
if (role.historical) {
|
||||
return;
|
||||
}
|
||||
LOCK(m_tx_download_mutex);
|
||||
|
||||
Reference in New Issue
Block a user