mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Adds attestation validation to SimpleSync
This commit is contained in:
@@ -5,7 +5,7 @@ use beacon_chain::{
|
||||
parking_lot::RwLockReadGuard,
|
||||
slot_clock::SlotClock,
|
||||
types::{BeaconState, ChainSpec},
|
||||
AggregationOutcome, CheckPoint,
|
||||
AttestationValidationError, CheckPoint,
|
||||
};
|
||||
use eth2_libp2p::rpc::HelloMessage;
|
||||
use types::{Attestation, BeaconBlock, BeaconBlockBody, BeaconBlockHeader, Epoch, Hash256, Slot};
|
||||
@@ -40,7 +40,7 @@ pub trait BeaconChain: Send + Sync {
|
||||
fn process_attestation(
|
||||
&self,
|
||||
attestation: Attestation,
|
||||
) -> Result<AggregationOutcome, BeaconChainError>;
|
||||
) -> Result<(), AttestationValidationError>;
|
||||
|
||||
fn get_block_roots(
|
||||
&self,
|
||||
@@ -126,14 +126,9 @@ where
|
||||
|
||||
fn process_attestation(
|
||||
&self,
|
||||
_attestation: Attestation,
|
||||
) -> Result<AggregationOutcome, BeaconChainError> {
|
||||
// Awaiting a proper operations pool before we can import attestations.
|
||||
//
|
||||
// Returning a useless error for now.
|
||||
//
|
||||
// https://github.com/sigp/lighthouse/issues/281
|
||||
return Err(BeaconChainError::DBInconsistent("CANNOT PROCESS".into()));
|
||||
attestation: Attestation,
|
||||
) -> Result<(), AttestationValidationError> {
|
||||
self.process_attestation(attestation)
|
||||
}
|
||||
|
||||
fn get_block_roots(
|
||||
|
||||
@@ -563,12 +563,9 @@ impl SimpleSync {
|
||||
"peer" => format!("{:?}", peer_id),
|
||||
);
|
||||
|
||||
// Awaiting a proper operations pool before we can import attestations.
|
||||
//
|
||||
// https://github.com/sigp/lighthouse/issues/281
|
||||
match self.chain.process_attestation(msg) {
|
||||
Ok(_) => panic!("Impossible, method not implemented."),
|
||||
Err(_) => error!(self.log, "Attestation processing not implemented!"),
|
||||
Ok(()) => info!(self.log, "ImportedAttestation"),
|
||||
Err(e) => warn!(self.log, "InvalidAttestation"; "error" => format!("{:?}", e)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user