Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Ensure transactional with ? works in frame v2 (#7982)
Browse files Browse the repository at this point in the history
  • Loading branch information
gui1117 authored Jan 26, 2021
1 parent 1490be7 commit d0723f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frame/support/test/tests/pallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ pub mod pallet {
#[pallet::compact] foo: u32,
) -> DispatchResultWithPostInfo {
Self::deposit_event(Event::Something(0));
if foo != 0 {
Ok(().into())
} else {
Err(Error::<T>::InsufficientProposersBalance.into())
if foo == 0 {
Err(Error::<T>::InsufficientProposersBalance)?;
}

Ok(().into())
}
}

Expand Down
3 changes: 2 additions & 1 deletion frame/support/test/tests/storage_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ fn transactional_annotation() {
#[transactional]
fn value_rollbacks(v: u32) -> result::Result<u32, &'static str> {
set_value(v)?;
Err("nah")
Err("nah")?;
Ok(v)
}

TestExternalities::default().execute_with(|| {
Expand Down

0 comments on commit d0723f1

Please sign in to comment.