diff --git a/src/avalanche/node.h b/src/avalanche/node.h --- a/src/avalanche/node.h +++ b/src/avalanche/node.h @@ -16,16 +16,20 @@ using TimePoint = std::chrono::time_point; -struct AvalancheNode { +namespace avalanche { + +struct Node { NodeId nodeid; PeerId peerid; TimePoint nextRequestTime; CPubKey pubkey; - AvalancheNode(NodeId nodeid_, PeerId peerid_, CPubKey pubkey_) + Node(NodeId nodeid_, PeerId peerid_, CPubKey pubkey_) : nodeid(nodeid_), peerid(peerid_), nextRequestTime(std::chrono::steady_clock::now()), pubkey(std::move(pubkey_)) {} }; +} // namespace avalanche + #endif // BITCOIN_AVALANCHE_NODE_H diff --git a/src/avalanche/peermanager.h b/src/avalanche/peermanager.h --- a/src/avalanche/peermanager.h +++ b/src/avalanche/peermanager.h @@ -20,6 +20,8 @@ #include #include +namespace avalanche { + struct Slot { private: uint64_t start; @@ -74,21 +76,19 @@ std::unordered_map peers; using NodeSet = boost::multi_index_container< - AvalancheNode, + Node, boost::multi_index::indexed_by< // index by nodeid - boost::multi_index::hashed_unique>, + boost::multi_index::hashed_unique< + boost::multi_index::member>, // sorted by peerid/nextRequestTime boost::multi_index::ordered_non_unique< boost::multi_index::tag, boost::multi_index::composite_key< - AvalancheNode, - boost::multi_index::member, - boost::multi_index::member< - AvalancheNode, TimePoint, - &AvalancheNode::nextRequestTime>>>>>; + Node, + boost::multi_index::member, + boost::multi_index::member>>>>; NodeSet nodes; @@ -109,8 +109,7 @@ bool addNodeToPeer(PeerId peerid, NodeId nodeid, CPubKey pubkey); bool removeNode(NodeId nodeid); - bool forNode(NodeId nodeid, - std::function func) const; + bool forNode(NodeId nodeid, std::function func) const; bool updateNextRequestTime(NodeId nodeid, TimePoint timeout); @@ -147,4 +146,6 @@ PeerId selectPeerImpl(const std::vector &slots, const uint64_t slot, const uint64_t max); +} // namespace avalanche + #endif // BITCOIN_AVALANCHE_PEERMANAGER_H diff --git a/src/avalanche/peermanager.cpp b/src/avalanche/peermanager.cpp --- a/src/avalanche/peermanager.cpp +++ b/src/avalanche/peermanager.cpp @@ -8,6 +8,8 @@ #include +namespace avalanche { + PeerId PeerManager::addPeer(PeerId p, uint32_t score) { auto inserted = peers.emplace(p, Peer(score, uint32_t(slots.size()))); assert(inserted.second); @@ -102,7 +104,7 @@ } // We actually have this node already, we need to update it. - return nodes.modify(nit, [&](AvalancheNode &n) { + return nodes.modify(nit, [&](Node &n) { n.peerid = peerid; n.pubkey = std::move(pubkey); }); @@ -112,8 +114,8 @@ return nodes.erase(nodeid) > 0; } -bool PeerManager::forNode( - NodeId nodeid, std::function func) const { +bool PeerManager::forNode(NodeId nodeid, + std::function func) const { auto it = nodes.find(nodeid); return it != nodes.end() && func(*it); } @@ -124,8 +126,7 @@ return false; } - return nodes.modify(it, - [&](AvalancheNode &n) { n.nextRequestTime = timeout; }); + return nodes.modify(it, [&](Node &n) { n.nextRequestTime = timeout; }); } NodeId PeerManager::getSuitableNodeToQuery() { @@ -296,3 +297,5 @@ // We failed to find a slot, retry. return NO_PEER; } + +} // namespace avalanche diff --git a/src/avalanche/processor.h b/src/avalanche/processor.h --- a/src/avalanche/processor.h +++ b/src/avalanche/processor.h @@ -25,7 +25,6 @@ class Config; class CBlockIndex; -class PeerManager; class CScheduler; /** @@ -57,6 +56,10 @@ */ static constexpr int AVALANCHE_MAX_INFLIGHT_POLL = 10; +namespace avalanche { + +class PeerManager; + /** * Vote history. */ @@ -136,7 +139,7 @@ bool addNodeToQuorum(NodeId nodeid); }; -class AvalancheBlockUpdate { +class BlockUpdate { union { CBlockIndex *pindex; uintptr_t raw; @@ -157,8 +160,7 @@ Finalized, }; - AvalancheBlockUpdate(CBlockIndex *pindexIn, Status statusIn) - : pindex(pindexIn) { + BlockUpdate(CBlockIndex *pindexIn, Status statusIn) : pindex(pindexIn) { raw |= statusIn; } @@ -169,7 +171,7 @@ } const CBlockIndex *getBlockIndex() const { - return const_cast(this)->getBlockIndex(); + return const_cast(this)->getBlockIndex(); } }; @@ -178,7 +180,11 @@ struct query_timeout {}; -class AvalancheProcessor { +namespace { + struct AvalancheTest; +} + +class Processor { CConnman *connman; std::chrono::milliseconds queryTimeoutDuration; @@ -235,8 +241,8 @@ EventLoop eventLoop; public: - explicit AvalancheProcessor(CConnman *connmanIn); - ~AvalancheProcessor(); + explicit Processor(CConnman *connmanIn); + ~Processor(); void setQueryTimeoutDuration(std::chrono::milliseconds d) { queryTimeoutDuration = d; @@ -249,11 +255,10 @@ // TDOD: Refactor the API to remove the dependency on avalanche/protocol.h void sendResponse(CNode *pfrom, AvalancheResponse response) const; bool registerVotes(NodeId nodeid, const AvalancheResponse &response, - std::vector &updates); + std::vector &updates); bool addPeer(NodeId nodeid, int64_t score, CPubKey pubkey); - bool forNode(NodeId nodeid, - std::function func) const; + bool forNode(NodeId nodeid, std::function func) const; CPubKey getSessionPubKey() const { return sessionKey.GetPubKey(); } @@ -266,12 +271,14 @@ std::vector getInvsForNextPoll(bool forPoll = true); NodeId getSuitableNodeToQuery(); - friend struct AvalancheTest; + friend struct ::avalanche::AvalancheTest; }; +} // namespace avalanche + /** * Global avalanche instance. */ -extern std::unique_ptr g_avalanche; +extern std::unique_ptr g_avalanche; #endif // BITCOIN_AVALANCHE_PROCESSOR_H diff --git a/src/avalanche/processor.cpp b/src/avalanche/processor.cpp --- a/src/avalanche/processor.cpp +++ b/src/avalanche/processor.cpp @@ -22,7 +22,9 @@ // Unfortunately, the bitcoind codebase is full of global and we are kinda // forced into it here. -std::unique_ptr g_avalanche; +std::unique_ptr g_avalanche; + +namespace avalanche { bool VoteRecord::registerVote(NodeId nodeid, uint32_t error) { // We just got a new vote, so there is one less inflight request. @@ -130,18 +132,18 @@ return true; } -AvalancheProcessor::AvalancheProcessor(CConnman *connmanIn) +Processor::Processor(CConnman *connmanIn) : connman(connmanIn), queryTimeoutDuration(AVALANCHE_DEFAULT_QUERY_TIMEOUT), round(0), peerManager(std::make_unique()) { // Pick a random key for the session. sessionKey.MakeNewKey(true); } -AvalancheProcessor::~AvalancheProcessor() { +Processor::~Processor() { stopEventLoop(); } -bool AvalancheProcessor::addBlockToReconcile(const CBlockIndex *pindex) { +bool Processor::addBlockToReconcile(const CBlockIndex *pindex) { bool isAccepted; { @@ -159,7 +161,7 @@ .second; } -bool AvalancheProcessor::isAccepted(const CBlockIndex *pindex) const { +bool Processor::isAccepted(const CBlockIndex *pindex) const { auto r = vote_records.getReadView(); auto it = r->find(pindex); if (it == r.end()) { @@ -169,7 +171,7 @@ return it->second.isAccepted(); } -int AvalancheProcessor::getConfidence(const CBlockIndex *pindex) const { +int Processor::getConfidence(const CBlockIndex *pindex) const { auto r = vote_records.getReadView(); auto it = r->find(pindex); if (it == r.end()) { @@ -180,45 +182,44 @@ } namespace { -/** - * When using TCP, we need to sign all messages as the transport layer is not - * secure. - */ -class TCPAvalancheResponse { - AvalancheResponse response; - std::array sig; - -public: - TCPAvalancheResponse(AvalancheResponse responseIn, const CKey &key) - : response(std::move(responseIn)) { - CHashWriter hasher(SER_GETHASH, 0); - hasher << response; - const uint256 hash = hasher.GetHash(); - - // Now let's sign! - std::vector vchSig; - if (key.SignSchnorr(hash, vchSig)) { - // Schnorr sigs are 64 bytes in size. - assert(vchSig.size() == 64); - std::copy(vchSig.begin(), vchSig.end(), sig.begin()); - } else { - sig.fill(0); + /** + * When using TCP, we need to sign all messages as the transport layer is + * not secure. + */ + class TCPAvalancheResponse { + AvalancheResponse response; + std::array sig; + + public: + TCPAvalancheResponse(AvalancheResponse responseIn, const CKey &key) + : response(std::move(responseIn)) { + CHashWriter hasher(SER_GETHASH, 0); + hasher << response; + const uint256 hash = hasher.GetHash(); + + // Now let's sign! + std::vector vchSig; + if (key.SignSchnorr(hash, vchSig)) { + // Schnorr sigs are 64 bytes in size. + assert(vchSig.size() == 64); + std::copy(vchSig.begin(), vchSig.end(), sig.begin()); + } else { + sig.fill(0); + } } - } - // serialization support - ADD_SERIALIZE_METHODS; + // serialization support + ADD_SERIALIZE_METHODS; - template - inline void SerializationOp(Stream &s, Operation ser_action) { - READWRITE(response); - READWRITE(sig); - } -}; + template + inline void SerializationOp(Stream &s, Operation ser_action) { + READWRITE(response); + READWRITE(sig); + } + }; } // namespace -void AvalancheProcessor::sendResponse(CNode *pfrom, - AvalancheResponse response) const { +void Processor::sendResponse(CNode *pfrom, AvalancheResponse response) const { connman->PushMessage( pfrom, CNetMsgMaker(pfrom->GetSendVersion()) @@ -226,9 +227,8 @@ TCPAvalancheResponse(std::move(response), sessionKey))); } -bool AvalancheProcessor::registerVotes( - NodeId nodeid, const AvalancheResponse &response, - std::vector &updates) { +bool Processor::registerVotes(NodeId nodeid, const AvalancheResponse &response, + std::vector &updates) { { // Save the time at which we can query again. LOCK(cs_peerManager); @@ -317,18 +317,16 @@ // This item has note been finalized, so we have nothing more to // do. updates.emplace_back( - pindex, vr.isAccepted() - ? AvalancheBlockUpdate::Status::Accepted - : AvalancheBlockUpdate::Status::Rejected); + pindex, vr.isAccepted() ? BlockUpdate::Status::Accepted + : BlockUpdate::Status::Rejected); continue; } // We just finalized a vote. If it is valid, then let the caller // know. Either way, remove the item from the map. - updates.emplace_back(pindex, - vr.isAccepted() - ? AvalancheBlockUpdate::Status::Finalized - : AvalancheBlockUpdate::Status::Invalid); + updates.emplace_back(pindex, vr.isAccepted() + ? BlockUpdate::Status::Finalized + : BlockUpdate::Status::Invalid); w->erase(it); } } @@ -336,7 +334,7 @@ return true; } -bool AvalancheProcessor::addPeer(NodeId nodeid, int64_t score, CPubKey pubkey) { +bool Processor::addPeer(NodeId nodeid, int64_t score, CPubKey pubkey) { LOCK(cs_peerManager); PeerId p = peerManager->addPeer(score); @@ -348,22 +346,22 @@ return inserted; } -bool AvalancheProcessor::forNode( - NodeId nodeid, std::function func) const { +bool Processor::forNode(NodeId nodeid, + std::function func) const { LOCK(cs_peerManager); return peerManager->forNode(nodeid, std::move(func)); } -bool AvalancheProcessor::startEventLoop(CScheduler &scheduler) { +bool Processor::startEventLoop(CScheduler &scheduler) { return eventLoop.startEventLoop( scheduler, [this]() { this->runEventLoop(); }, AVALANCHE_TIME_STEP); } -bool AvalancheProcessor::stopEventLoop() { +bool Processor::stopEventLoop() { return eventLoop.stopEventLoop(); } -std::vector AvalancheProcessor::getInvsForNextPoll(bool forPoll) { +std::vector Processor::getInvsForNextPoll(bool forPoll) { std::vector invs; // First remove all blocks that are not worth polling. @@ -402,12 +400,12 @@ return invs; } -NodeId AvalancheProcessor::getSuitableNodeToQuery() { +NodeId Processor::getSuitableNodeToQuery() { LOCK(cs_peerManager); return peerManager->getSuitableNodeToQuery(); } -void AvalancheProcessor::clearTimedoutRequests() { +void Processor::clearTimedoutRequests() { auto now = std::chrono::steady_clock::now(); std::map timedout_items{}; @@ -455,7 +453,7 @@ } } -void AvalancheProcessor::runEventLoop() { +void Processor::runEventLoop() { // First things first, check if we have requests that timed out and clear // them. clearTimedoutRequests(); @@ -516,3 +514,5 @@ nodeid = getSuitableNodeToQuery(); } while (nodeid != NO_NODE); } + +} // namespace avalanche diff --git a/src/avalanche/test/peermanager_tests.cpp b/src/avalanche/test/peermanager_tests.cpp --- a/src/avalanche/test/peermanager_tests.cpp +++ b/src/avalanche/test/peermanager_tests.cpp @@ -8,6 +8,8 @@ #include +using namespace avalanche; + BOOST_FIXTURE_TEST_SUITE(peermanager_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(select_peer_linear) { diff --git a/src/avalanche/test/processor_tests.cpp b/src/avalanche/test/processor_tests.cpp --- a/src/avalanche/test/processor_tests.cpp +++ b/src/avalanche/test/processor_tests.cpp @@ -13,24 +13,30 @@ #include -struct AvalancheTest { - static void runEventLoop(AvalancheProcessor &p) { p.runEventLoop(); } +using namespace avalanche; - static std::vector getInvsForNextPoll(AvalancheProcessor &p) { - return p.getInvsForNextPoll(false); - } +namespace avalanche { +namespace { + struct AvalancheTest { + static void runEventLoop(avalanche::Processor &p) { p.runEventLoop(); } - static NodeId getSuitableNodeToQuery(AvalancheProcessor &p) { - return p.getSuitableNodeToQuery(); - } + static std::vector getInvsForNextPoll(Processor &p) { + return p.getInvsForNextPoll(false); + } - static PeerManager &getPeerManager(AvalancheProcessor &p) { - LOCK(p.cs_peerManager); - return *p.peerManager; - } + static NodeId getSuitableNodeToQuery(Processor &p) { + return p.getSuitableNodeToQuery(); + } - static uint64_t getRound(const AvalancheProcessor &p) { return p.round; } -}; + static PeerManager &getPeerManager(Processor &p) { + LOCK(p.cs_peerManager); + return *p.peerManager; + } + + static uint64_t getRound(const Processor &p) { return p.round; } + }; +} // namespace +} // namespace avalanche struct CConnmanTest : public CConnman { using CConnman::CConnman; @@ -159,15 +165,15 @@ CBlockIndex index; CBlockIndex *pindex = &index; - std::set status{ - AvalancheBlockUpdate::Status::Invalid, - AvalancheBlockUpdate::Status::Rejected, - AvalancheBlockUpdate::Status::Accepted, - AvalancheBlockUpdate::Status::Finalized, + std::set status{ + BlockUpdate::Status::Invalid, + BlockUpdate::Status::Rejected, + BlockUpdate::Status::Accepted, + BlockUpdate::Status::Finalized, }; for (auto s : status) { - AvalancheBlockUpdate abu(pindex, s); + BlockUpdate abu(pindex, s); BOOST_CHECK(abu.getBlockIndex() == pindex); BOOST_CHECK_EQUAL(abu.getStatus(), s); } @@ -197,7 +203,7 @@ return node; } -std::array ConnectNodes(const Config &config, AvalancheProcessor &p, +std::array ConnectNodes(const Config &config, Processor &p, ServiceFlags nServices, PeerLogicValidation &peerLogic, CConnmanTest *connman) { @@ -226,8 +232,8 @@ auto peerLogic = std::make_unique( connman.get(), nullptr, *m_node.scheduler, false); - AvalancheProcessor p(connman.get()); - std::vector updates; + Processor p(connman.get()); + std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); const BlockHash blockHash = block.GetHash(); @@ -322,8 +328,7 @@ registerNewVote(next(resp)); BOOST_CHECK_EQUAL(updates.size(), 1); BOOST_CHECK(updates[0].getBlockIndex() == pindex); - BOOST_CHECK_EQUAL(updates[0].getStatus(), - AvalancheBlockUpdate::Status::Finalized); + BOOST_CHECK_EQUAL(updates[0].getStatus(), BlockUpdate::Status::Finalized); updates = {}; // Once the decision is finalized, there is no poll for it. @@ -349,8 +354,7 @@ BOOST_CHECK(!p.isAccepted(pindex)); BOOST_CHECK_EQUAL(updates.size(), 1); BOOST_CHECK(updates[0].getBlockIndex() == pindex); - BOOST_CHECK_EQUAL(updates[0].getStatus(), - AvalancheBlockUpdate::Status::Rejected); + BOOST_CHECK_EQUAL(updates[0].getStatus(), BlockUpdate::Status::Rejected); updates = {}; // Now it is rejected, but we can vote for it numerous times. @@ -371,8 +375,7 @@ BOOST_CHECK(!p.isAccepted(pindex)); BOOST_CHECK_EQUAL(updates.size(), 1); BOOST_CHECK(updates[0].getBlockIndex() == pindex); - BOOST_CHECK_EQUAL(updates[0].getStatus(), - AvalancheBlockUpdate::Status::Invalid); + BOOST_CHECK_EQUAL(updates[0].getStatus(), BlockUpdate::Status::Invalid); updates = {}; // Once the decision is finalized, there is no poll for it. @@ -394,10 +397,10 @@ auto peerLogic = std::make_unique( connman.get(), nullptr, *m_node.scheduler, false); - AvalancheProcessor p(connman.get()); + Processor p(connman.get()); CBlockIndex indexA, indexB; - std::vector updates; + std::vector updates; // Create several nodes that support avalanche. auto avanodes = @@ -479,8 +482,7 @@ BOOST_CHECK(p.registerVotes(firstNodeid, next(resp), updates)); BOOST_CHECK_EQUAL(updates.size(), 1); BOOST_CHECK(updates[0].getBlockIndex() == pindexA); - BOOST_CHECK_EQUAL(updates[0].getStatus(), - AvalancheBlockUpdate::Status::Finalized); + BOOST_CHECK_EQUAL(updates[0].getStatus(), BlockUpdate::Status::Finalized); updates = {}; // We do not vote on A anymore. @@ -493,8 +495,7 @@ BOOST_CHECK(p.registerVotes(secondNodeid, resp, updates)); BOOST_CHECK_EQUAL(updates.size(), 1); BOOST_CHECK(updates[0].getBlockIndex() == pindexB); - BOOST_CHECK_EQUAL(updates[0].getStatus(), - AvalancheBlockUpdate::Status::Finalized); + BOOST_CHECK_EQUAL(updates[0].getStatus(), BlockUpdate::Status::Finalized); updates = {}; // There is nothing left to vote on. @@ -511,9 +512,9 @@ auto peerLogic = std::make_unique( connman.get(), nullptr, *m_node.scheduler, false); - AvalancheProcessor p(connman.get()); + Processor p(connman.get()); - std::vector updates; + std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); const BlockHash blockHash = block.GetHash(); @@ -660,9 +661,9 @@ auto peerLogic = std::make_unique( connman.get(), nullptr, *m_node.scheduler, false); - AvalancheProcessor p(connman.get()); + Processor p(connman.get()); - std::vector updates; + std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); const BlockHash blockHash = block.GetHash(); @@ -724,7 +725,7 @@ auto peerLogic = std::make_unique( connman.get(), nullptr, *m_node.scheduler, false); - AvalancheProcessor p(connman.get()); + Processor p(connman.get()); // Create enough nodes so that we run into the inflight request limit. PeerManager &pm = AvalancheTest::getPeerManager(p); @@ -767,7 +768,7 @@ AvalancheTest::runEventLoop(p); BOOST_CHECK_EQUAL(AvalancheTest::getSuitableNodeToQuery(p), suitablenodeid); - std::vector updates; + std::vector updates; // Send one response, now we can poll again. auto it = node_round_map.begin(); @@ -790,8 +791,8 @@ auto peerLogic = std::make_unique( connman.get(), nullptr, *m_node.scheduler, false); - AvalancheProcessor p(connman.get()); - std::vector updates; + Processor p(connman.get()); + std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); const BlockHash blockHash = block.GetHash(); @@ -866,7 +867,7 @@ auto peerLogic = std::make_unique( connman.get(), nullptr, *m_node.scheduler, false); - AvalancheProcessor p(connman.get()); + Processor p(connman.get()); CScheduler s; CBlock block = CreateAndProcessBlock({}, CScript()); @@ -920,7 +921,7 @@ auto queryTime = std::chrono::steady_clock::now() + std::chrono::milliseconds(100); - std::vector updates; + std::vector updates; p.registerVotes(nodeid, {queryRound, 100, {AvalancheVote(0, blockHash)}}, updates); for (int i = 0; i < 10000; i++) { @@ -959,7 +960,7 @@ std::thread schedulerThread(std::bind(&CScheduler::serviceQueue, &s)); { - AvalancheProcessor p(m_node.connman.get()); + Processor p(m_node.connman.get()); BOOST_CHECK(p.startEventLoop(s)); BOOST_CHECK_EQUAL(s.getQueueInfo(start, stop), 1); } diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -194,7 +194,7 @@ // to shut them down in this order: // 1. Stop avalanche event loop. // 2. Shutdown network processing. - // 3. Destroy AvalancheProcessor. + // 3. Destroy avalanche::Processor. // 4. Destroy CConnman if (g_avalanche) { g_avalanche->stopEventLoop(); @@ -2325,7 +2325,7 @@ } // Step 6.5 (I guess ?): Initialize Avalanche. - g_avalanche = std::make_unique(node.connman.get()); + g_avalanche = std::make_unique(node.connman.get()); // Step 7: load block chain diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3630,20 +3630,21 @@ AvalancheResponse response; verifier >> response; - if (!g_avalanche->forNode(pfrom->GetId(), [&](const AvalancheNode &n) { - std::array sig; - vRecv >> sig; - - // Unfortunately, the verify API require a vector. - std::vector vchSig{sig.begin(), sig.end()}; - return n.pubkey.VerifySchnorr(verifier.GetHash(), vchSig); - })) { + if (!g_avalanche->forNode( + pfrom->GetId(), [&](const avalanche::Node &n) { + std::array sig; + vRecv >> sig; + + // Unfortunately, the verify API require a vector. + std::vector vchSig{sig.begin(), sig.end()}; + return n.pubkey.VerifySchnorr(verifier.GetHash(), vchSig); + })) { LOCK(cs_main); Misbehaving(pfrom, 100, "invalid-ava-response-signature"); return true; } - std::vector updates; + std::vector updates; if (!g_avalanche->registerVotes(pfrom->GetId(), response, updates)) { LOCK(cs_main); Misbehaving(pfrom, 100, "invalid-ava-response-content"); @@ -3651,11 +3652,11 @@ } if (updates.size()) { - for (AvalancheBlockUpdate &u : updates) { + for (avalanche::BlockUpdate &u : updates) { CBlockIndex *pindex = u.getBlockIndex(); switch (u.getStatus()) { - case AvalancheBlockUpdate::Status::Invalid: - case AvalancheBlockUpdate::Status::Rejected: { + case avalanche::BlockUpdate::Status::Invalid: + case avalanche::BlockUpdate::Status::Rejected: { CValidationState state; ParkBlock(config, state, pindex); if (!state.IsValid()) { @@ -3663,8 +3664,8 @@ state.GetRejectReason()); } } break; - case AvalancheBlockUpdate::Status::Accepted: - case AvalancheBlockUpdate::Status::Finalized: { + case avalanche::BlockUpdate::Status::Accepted: + case avalanche::BlockUpdate::Status::Finalized: { LOCK(cs_main); UnparkBlock(pindex); } break;