diff --git a/crates/blockchain/src/lib.rs b/crates/blockchain/src/lib.rs index 9f70a80..805c3b7 100644 --- a/crates/blockchain/src/lib.rs +++ b/crates/blockchain/src/lib.rs @@ -203,7 +203,7 @@ impl BlockChainServer { // this the aggregator never sees its own validator's signature in // gossip_signatures and it is excluded from aggregated proofs. if self.is_aggregator { - let _ = store::on_gossip_attestation(&mut self.store, signed_attestation.clone()) + let _ = store::on_gossip_attestation(&mut self.store, &signed_attestation) .inspect_err(|err| { warn!(%slot, %validator_id, %err, "Self-delivery of attestation failed") }); @@ -488,7 +488,7 @@ impl BlockChainServer { } } - fn on_gossip_attestation(&mut self, attestation: SignedAttestation) { + fn on_gossip_attestation(&mut self, attestation: &SignedAttestation) { if !self.is_aggregator { warn!("Received unaggregated attestation but node is not an aggregator"); return; @@ -553,7 +553,7 @@ impl Handler for BlockChainServer { impl Handler for BlockChainServer { async fn handle(&mut self, msg: NewAttestation, _ctx: &Context) { - self.on_gossip_attestation(msg.attestation); + self.on_gossip_attestation(&msg.attestation); } } diff --git a/crates/blockchain/src/store.rs b/crates/blockchain/src/store.rs index eb8c4fe..1d48e64 100644 --- a/crates/blockchain/src/store.rs +++ b/crates/blockchain/src/store.rs @@ -356,12 +356,12 @@ pub fn on_tick( /// at interval 2. Only aggregator nodes receive unaggregated gossip attestations. pub fn on_gossip_attestation( store: &mut Store, - signed_attestation: SignedAttestation, + signed_attestation: &SignedAttestation, ) -> Result<(), StoreError> { let validator_id = signed_attestation.validator_id; let attestation = Attestation { validator_id, - data: signed_attestation.data, + data: signed_attestation.data.clone(), }; validate_attestation_data(store, &attestation.data) .inspect_err(|_| metrics::inc_attestations_invalid())?;