Add process_attestation to BeaconChain

This commit is contained in:
Paul Hauner 2019-03-29 18:40:50 +11:00
parent 46a978a5a9
commit 8b1a91e9ee
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6

View File

@ -541,6 +541,17 @@ where
Ok(aggregation_outcome)
}
/// Accept a new attestation from the network.
///
/// If valid, the attestation is added to the `op_pool` and aggregated with another attestation
/// if possible.
pub fn process_attestation(&self, attestation: Attestation) {
let _ =
self.op_pool
.write()
.insert_attestation(attestation, &*self.state.read(), &self.spec);
}
/// Accept some deposit and queue it for inclusion in an appropriate block.
pub fn receive_deposit_for_inclusion(&self, deposit: Deposit) {
// Bad deposits are ignored.
@ -701,9 +712,9 @@ where
trace!("Finding attestations for new block...");
let attestations = self
.attestation_aggregator
.op_pool
.read()
.get_attestations_for_state(&state, &self.spec);
.get_attestations(&*self.state.read(), &self.spec);
trace!(
"Inserting {} attestation(s) into new block.",