Remove proposal when it is refused (#4399)

* Remove proposal when it is refused.

* Fix build, add test
This commit is contained in:
Gavin Wood
2019-12-16 15:24:03 +08:00
committed by Bastian Köcher
parent 11382de277
commit 83711ca221
+15
View File
@@ -242,6 +242,7 @@ decl_module! {
}
} else {
// disapproved
<ProposalOf<T, I>>::remove(&proposal);
Self::deposit_event(RawEvent::Disapproved(proposal));
}
@@ -648,6 +649,20 @@ mod tests {
});
}
#[test]
fn motions_reproposing_disapproved_works() {
make_ext().execute_with(|| {
System::set_block_number(1);
let proposal = make_proposal(42);
let hash: H256 = proposal.blake2_256().into();
assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone())));
assert_ok!(Collective::vote(Origin::signed(2), hash.clone(), 0, false));
assert_eq!(Collective::proposals(), vec![]);
assert_ok!(Collective::propose(Origin::signed(1), 2, Box::new(proposal.clone())));
assert_eq!(Collective::proposals(), vec![hash]);
});
}
#[test]
fn motions_disapproval_works() {
make_ext().execute_with(|| {