Use head state for exit verification

This commit is contained in:
Paul Hauner
2023-04-13 09:27:56 +10:00
parent a53830fd60
commit 1da556e7eb

View File

@@ -2173,12 +2173,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
&self, &self,
exit: SignedVoluntaryExit, exit: SignedVoluntaryExit,
) -> Result<ObservationOutcome<SignedVoluntaryExit, T::EthSpec>, Error> { ) -> Result<ObservationOutcome<SignedVoluntaryExit, T::EthSpec>, Error> {
// NOTE: this could be more efficient if it avoided cloning the head state let head_snapshot = self.head().snapshot;
let wall_clock_state = self.wall_clock_state()?; let head_state = &head_snapshot.beacon_state;
Ok(self Ok(self
.observed_voluntary_exits .observed_voluntary_exits
.lock() .lock()
.verify_and_observe(exit, &wall_clock_state, &self.spec) .verify_and_observe(exit, head_state, &self.spec)
.map(|exit| { .map(|exit| {
// this method is called for both API and gossip exits, so this covers all exit events // this method is called for both API and gossip exits, so this covers all exit events
if let Some(event_handler) = self.event_handler.as_ref() { if let Some(event_handler) = self.event_handler.as_ref() {