diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -5272,15 +5272,6 @@ } } - // If there is no shortid, avoid parsing/responding/accounting for the - // message. - if (compactProofs.getShortIDs().size() == 0) { - LogPrint(BCLog::AVALANCHE, - "Got an avaproofs message with no shortid (peer %d)\n", - pfrom.GetId()); - return; - } - // To determine the chance that the number of entries in a bucket // exceeds N, we use the fact that the number of elements in a single // bucket is binomially distributed (with n = the number of shorttxids @@ -5342,8 +5333,16 @@ // We want to keep a count of how many nodes we successfully requested // avaproofs from as this is used to determine when we are confident our - // quorum is close enough to the other participants. - g_avalanche->avaproofsSent(pfrom.GetId()); + // quorum is close enough to the other participants. If there was no + // short id the message was not contributing to our quorum so we don't + // account for this node. + if (compactProofs.getShortIDs().size() == 0) { + LogPrint(BCLog::AVALANCHE, + "Got an avaproofs message with no shortid (peer %d)\n", + pfrom.GetId()); + } else { + g_avalanche->avaproofsSent(pfrom.GetId()); + } return; } diff --git a/test/functional/abc_p2p_avalanche_quorum.py b/test/functional/abc_p2p_avalanche_quorum.py --- a/test/functional/abc_p2p_avalanche_quorum.py +++ b/test/functional/abc_p2p_avalanche_quorum.py @@ -17,7 +17,6 @@ AvalancheVote, AvalancheVoteError, ) -from test_framework.p2p import p2p_lock from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal @@ -118,17 +117,12 @@ avapeer.wait_until( lambda: avapeer.last_message.get("getavaproofs")) - if empty_avaproof: - avapeer.send_message(build_msg_avaproofs([])) - avapeer.sync_send_with_ping() - with p2p_lock: - assert_equal( - avapeer.message_count.get( - "avaproofsreq", 0), 0) - else: - avapeer.send_and_ping(build_msg_avaproofs([peer['proof']])) - avapeer.wait_until( - lambda: avapeer.last_message.get("avaproofsreq")) + avapeer.send_and_ping( + build_msg_avaproofs( + [] if empty_avaproof else [ + peer['proof']])) + avapeer.wait_until( + lambda: avapeer.last_message.get("avaproofsreq")) return avapeer diff --git a/test/functional/abc_p2p_compactproofs.py b/test/functional/abc_p2p_compactproofs.py --- a/test/functional/abc_p2p_compactproofs.py +++ b/test/functional/abc_p2p_compactproofs.py @@ -326,16 +326,11 @@ avaproofsreq = received_avaproofsreq(peer) assert_equal(avaproofsreq.indices, expected_indices) - self.log.info("Check no proof is requested if there is no shortid") + self.log.info( + "Check the node sends a empty request if there is no shortid") - msg = build_msg_avaproofs([]) - sender = add_avalanche_p2p_outbound() with node.assert_debug_log(["Got an avaproofs message with no shortid"]): - sender.send_message(msg) - # Make sure we don't get an avaproofsreq message - sender.sync_send_with_ping() - with p2p_lock: - assert_equal(sender.message_count.get("avaproofsreq", 0), 0) + expect_indices([], []) self.log.info( "Check the node requests all the proofs if it known none")