From a9fcaf16a65513e94d082fddb8f1b4ef62e0977e Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Fri, 25 Oct 2019 14:00:55 +0000 Subject: [PATCH] stop double-counting attestation-topic attestations (#501) --- beacon_chain/beacon_node.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index 82935cd25..23efd53a1 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -34,7 +34,7 @@ declareGauge beacon_pending_exits, "Number of pending voluntary exits in local o declareCounter beacon_attestations_sent, "Number of beacon chain attestations sent by this peer" declareCounter beacon_attestations_received, "Number of beacon chain attestations received by this peer" declareCounter beacon_blocks_proposed, "Number of beacon chain blocks sent by this peer" -declareCounter beacon_blocks_received, "Number of becon chain blocks received by this peer" +declareCounter beacon_blocks_received, "Number of beacon chain blocks received by this peer" logScope: topics = "beacnde" @@ -474,10 +474,6 @@ proc onAttestation(node: BeaconNode, attestation: Attestation) = signature = shortLog(attestation.signature), cat = "consensus" # Tag "consensus|attestation"? - # This is the shared codepath for both topic attestation and beacon block - # attestations. - beacon_attestations_received.inc() - if (let attestedBlock = node.blockPool.getOrResolve( attestation.data.beacon_block_root); attestedBlock != nil): let @@ -794,6 +790,10 @@ proc run*(node: BeaconNode) = onBeaconBlock(node, blck) waitFor node.network.subscribe(topicAttestations) do (attestation: Attestation): + # Avoid double-counting attestation-topic attestations on shared codepath + # when they're reflected through beacon blocks + beacon_attestations_received.inc() + node.onAttestation(attestation) let