From 64a6e1475c567d9dd137033a93f6ab27291a0dd8 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 10 Aug 2019 11:31:31 +1000 Subject: [PATCH] Various minor fixes --- beacon_node/beacon_chain/src/beacon_chain.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 834b04582d..7fefb7690f 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -539,11 +539,11 @@ impl BeaconChain { // (e.g., if there are skip slots between the epoch the block was created in and // the epoch for the attestation). if state.current_epoch() == attestation.data.target.epoch - && (state - .get_block_root(attestation_head_block.slot) - .map(|root| *root == attestation.data.beacon_block_root) - .unwrap_or_else(|_| false) - || attestation.data.beacon_block_root == self.head().beacon_block_root) + && (attestation.data.beacon_block_root == self.head().beacon_block_root + || state + .get_block_root(attestation_head_block.slot) + .map(|root| *root == attestation.data.beacon_block_root) + .unwrap_or_else(|_| false)) { // The head state is able to be used to validate this attestation. No need to load // anything from the database. @@ -558,6 +558,7 @@ impl BeaconChain { }; if let Some(outcome) = optional_outcome { + // Verification was already completed with an in-memory state. Return that result. outcome } else { // Use the `data.beacon_block_root` to load the state from the latest non-skipped @@ -612,13 +613,13 @@ impl BeaconChain { } } } else { - // Reject any block where we have not processed `attestation.data.beacon_block_root`. + // Drop any attestation where we have not processed `attestation.data.beacon_block_root`. // // This is likely overly restrictive, we could store the attestation for later // processing. warn!( self.log, - "Dropping attestation for unknown block"; + "Dropped attestation for unknown block"; "block" => format!("{}", attestation.data.beacon_block_root) ); Ok(AttestationProcessingOutcome::UnknownHeadBlock {