Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
delay write until after validation checks
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshOrndorff committed Apr 7, 2022
1 parent ca9bc6b commit f3f9cdd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pallets/author-inherent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,17 @@ pub mod pallet {
"Block invalid; Supplied slot number is not high enough"
);

HighestSlotSeen::<T>::put(slot);

// Now check that the author is valid in this slot
let author = <Author<T>>::get()
.expect("Block invalid, no authorship information supplied in preruntime digest.");

assert!(
T::CanAuthor::can_author(&author, &T::SlotBeacon::slot()),
"Block invalid, supplied author is not eligible."
);

// Once that is validated, update the stored slot number
HighestSlotSeen::<T>::put(slot);

Ok(Pays::No.into())
}
}
Expand Down

0 comments on commit f3f9cdd

Please sign in to comment.