Repository navigation
fix: fetch orphan-vote parents via the request tracker instead of broadcasting #7526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3042532
1be2dba
f694169
6e6e0de
10abb8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -45,23 +45,9 @@ void NetGovernance::Schedule(CScheduler& scheduler) | |||||
| [this]() -> void { | ||||||
| if (!m_node_sync.IsSynced()) return; | ||||||
|
|
||||||
|
Comment on lines
46
to
47
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🟡 Suggestion: Run orphan expiry while blockchain sync is complete The scheduler returns unless
Suggested change
source:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving the gate as is. On develop the 5-minute task already returns unless Loosening it to 🤖 Posted autonomously by Claude on behalf of pasta.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed that this is pre-existing behavior: the Noted as intentionally deferred; I will not press it further here. |
||||||
| // Request governance objects for orphan votes | ||||||
| auto vecOrphanHashes = m_gov_manager.GetOrphanVoteObjectHashes(); | ||||||
| if (!vecOrphanHashes.empty()) { | ||||||
| LogPrint(BCLog::GOBJECT, "NetGovernance::Schedule -- requesting %d orphan objects\n", | ||||||
| vecOrphanHashes.size()); | ||||||
| const CConnman::NodesSnapshot snap{m_connman, CConnman::FullyConnectedOnly}; | ||||||
| for (const uint256& nHash : vecOrphanHashes) { | ||||||
| for (CNode* pnode : snap.Nodes()) { | ||||||
| if (!pnode->CanRelay()) continue; | ||||||
| CNetMsgMaker msgMaker(pnode->GetCommonVersion()); | ||||||
| CBloomFilter filter; // Empty filter - we want the object, not votes | ||||||
| m_connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MNGOVERNANCESYNC, nHash, filter)); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // CHECK AND REMOVE - REPROCESS GOVERNANCE OBJECTS | ||||||
| // Also expires orphan votes whose parent object never arrived. Fetching those parents | ||||||
| // is driven by the object request tracker from ProcessMessage(), not from here. | ||||||
| m_gov_manager.CheckAndRemove(); | ||||||
| }, | ||||||
| std::chrono::minutes{5}); | ||||||
|
|
@@ -113,9 +99,9 @@ void NetGovernance::ProcessMessage(CNode& peer, const std::string& msg_type, CDa | |||||
| LogPrint(BCLog::GOBJECT, "MNGOVERNANCESYNC -- syncing governance objects to our peer %s\n", peer.GetLogString()); | ||||||
| const bool full_sync{nProp == uint256()}; | ||||||
| const bool object_fetch{!full_sync && IsEmptyBloomFilter(filter)}; | ||||||
| // Nonzero govsync with an empty filter is used to retry missing-object | ||||||
| // fetches for orphan votes. Only full sync and actual known-object vote | ||||||
| // sync are fulfilled-request limited. | ||||||
| // Nonzero govsync with an empty filter is how older peers retry | ||||||
| // missing-object fetches for orphan votes. Only full sync and actual | ||||||
| // known-object vote sync are fulfilled-request limited. | ||||||
| const bool track_request{full_sync || (!object_fetch && m_gov_manager.HaveSyncableObjectForHash(nProp))}; | ||||||
| const std::string fulfilled_request{full_sync ? | ||||||
| NetMsgType::MNGOVERNANCESYNC : | ||||||
|
|
@@ -257,11 +243,13 @@ void NetGovernance::ProcessMessage(CNode& peer, const std::string& msg_type, CDa | |||||
| // m_peer_manager->PeerRelayInv(CInv{MSG_GOVERNANCE_OBJECT_VOTE, nHash}); | ||||||
| } else { | ||||||
| LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- Rejected vote, error = %s\n", exception.what()); | ||||||
| if (hashToRequest != uint256()) { | ||||||
| // Orphan vote - request the missing governance object | ||||||
| CNetMsgMaker msgMaker(peer.GetCommonVersion()); | ||||||
| CBloomFilter filter; // Empty filter - we just want the object, not votes | ||||||
| m_connman.PushMessage(&peer, msgMaker.Make(NetMsgType::MNGOVERNANCESYNC, hashToRequest, filter)); | ||||||
| if (!hashToRequest.IsNull()) { | ||||||
|
PastaPastaPasta marked this conversation as resolved.
|
||||||
| // Orphan vote: fetch the parent object through the request tracker, which owns | ||||||
| // GETDATA scheduling, per-peer in-flight limits, expiry and fallback to another | ||||||
| // peer. Register this peer explicitly -- holding a vote for the object is evidence | ||||||
| // it has the object, and it may never have announced the object to us. | ||||||
| m_peer_manager->PeerAskPeersForObject(CInv{MSG_GOVERNANCE_OBJECT, hashToRequest}, | ||||||
| peer.GetId()); | ||||||
| } | ||||||
| if ((exception.GetNodePenalty() != 0) && m_node_sync.IsSynced()) { | ||||||
| m_peer_manager->PeerMisbehaving(peer.GetId(), exception.GetNodePenalty()); | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.