Fix invalid state transitions in pallet-bounties (#11630)

* Pallet-bounty: disallow invalid state transitions

* Fix tests: funding only at even block numbers

* Fix benchmarks: bounties need to be funded

* fix on_initialize

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Torsten StüberandShawn Tabrizi authored and GitHub committed 2022-07-18 12:56:22 +00:00
1 parent 8f6ba2e75e
commit 4e787fbd30
3 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -390,7 +390,7 @@ pub mod pallet {
Bounties::<T, I>::try_mutate_exists(bounty_id, |maybe_bounty| -> DispatchResult {
let mut bounty = maybe_bounty.as_mut().ok_or(Error::<T, I>::InvalidIndex)?;
match bounty.status {
BountyStatus::Proposed | BountyStatus::Approved | BountyStatus::Funded => {},
BountyStatus::Funded => {},
_ => return Err(Error::<T, I>::UnexpectedStatus.into()),
};