stop double-counting attestation-topic attestations (#501)

This commit is contained in:
Dustin Brody 2019-10-25 14:00:55 +00:00 committed by GitHub
parent 363f918f7b
commit a9fcaf16a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -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