-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: keep sending ISDLOCK invs to non-MN peers with watchquorums #7293
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
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 |
|---|---|---|
|
|
@@ -1193,6 +1193,16 @@ static uint16_t GetHeadersLimit(const CNode& pfrom, bool compressed) | |
| return MAX_HEADERS_UNCOMPRESSED_RESULT; | ||
| } | ||
|
|
||
| // Returns true when peer is a verified masternode that has opted in to receive recsigs. | ||
| // Such peers participate in the signing flow that populates creatingInstantSendLocks, so | ||
| // they can reconstruct an ISDLOCK locally from the recsig and don't need the ISDLOCK inv. | ||
| // Non-MN peers (e.g. nodes running with -watchquorums) also opt in to recsigs via | ||
| // QSENDRECSIGS but still need ISDLOCK invs because they don't run the signing flow. | ||
| static bool PeerReconstructsISLockFromRecsig(const CNode& pnode, const Peer& peer) | ||
| { | ||
| return peer.m_wants_recsigs && !pnode.GetVerifiedProRegTxHash().IsNull(); | ||
| } | ||
|
Comment on lines
+1196
to
+1204
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: Helper assumes every verified-MN peer can reconstruct an ISDLOCK PeerReconstructsISLockFromRecsig treats source: ['claude'] 🤖 Fix this with AI agents |
||
|
|
||
| static void PushInv(Peer& peer, const CInv& inv) | ||
| { | ||
| auto inv_relay = peer.GetInvRelay(); | ||
|
|
@@ -1204,13 +1214,6 @@ static void PushInv(Peer& peer, const CInv& inv) | |
| return; | ||
| } | ||
|
|
||
| // Skip ISDLOCK inv announcements for peers that want recsigs, as they can reconstruct | ||
| // the islock from the recsig | ||
| if (inv.type == MSG_ISDLOCK && peer.m_wants_recsigs) { | ||
| LogPrint(BCLog::NET, "%s -- skipping ISDLOCK inv (peer wants recsigs): %s peer=%d\n", __func__, inv.ToString(), peer.m_id); | ||
| return; | ||
| } | ||
|
|
||
| LOCK(inv_relay->m_tx_inventory_mutex); | ||
| if (inv_relay->m_tx_inventory_known_filter.contains(inv.hash)) { | ||
| LogPrint(BCLog::NET, "%s -- skipping known inv: %s peer=%d\n", __func__, inv.ToString(), peer.m_id); | ||
|
|
@@ -2541,6 +2544,11 @@ void PeerManagerImpl::RelayInvFiltered(const CInv& inv, const CTransaction& rela | |
| return; | ||
| } | ||
| } // LOCK(tx_relay->m_bloom_filter_mutex) | ||
| if (inv.type == MSG_ISDLOCK && PeerReconstructsISLockFromRecsig(*pnode, *peer)) { | ||
| LogPrint(BCLog::NET, "%s -- skipping ISDLOCK inv (peer wants recsigs): %s peer=%d\n", | ||
| __func__, inv.ToString(), peer->m_id); | ||
| return; | ||
| } | ||
| PushInv(*peer, inv); | ||
| }); | ||
| } | ||
|
|
@@ -2566,6 +2574,11 @@ void PeerManagerImpl::RelayInvFiltered(const CInv& inv, const uint256& relatedTx | |
| return; | ||
| } | ||
| } // LOCK(tx_relay->m_bloom_filter_mutex) | ||
| if (inv.type == MSG_ISDLOCK && PeerReconstructsISLockFromRecsig(*pnode, *peer)) { | ||
| LogPrint(BCLog::NET, "%s -- skipping ISDLOCK inv (peer wants recsigs): %s peer=%d\n", | ||
| __func__, inv.ToString(), peer->m_id); | ||
| return; | ||
| } | ||
|
Comment on lines
2547
to
+2581
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. 💬 Nitpick: Duplicated ISDLOCK skip-and-log block in both RelayInvFiltered overloads The four-line source: ['claude'] |
||
| PushInv(*peer, inv); | ||
| }); | ||
| } | ||
|
|
@@ -6348,9 +6361,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto) | |
| if (islock == nullptr) continue; | ||
| uint256 isLockHash{::SerializeHash(*islock)}; | ||
| tx_relay->m_tx_inventory_known_filter.insert(isLockHash); | ||
| // Skip ISDLOCK inv announcements for peers that want recsigs, as they can reconstruct | ||
| // the islock from the recsig | ||
| if (!peer->m_wants_recsigs) { | ||
| if (!PeerReconstructsISLockFromRecsig(*pto, *peer)) { | ||
| queueAndMaybePushInv(CInv(MSG_ISDLOCK, isLockHash)); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.