Print bad mandatory error (#6416)

* Print bad mandatory error

This prints the error that leads to bad mandatory.

* Update frame/system/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Adds missing trait import

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Bastian Köcher
2020-06-19 13:15:21 +02:00
committed by GitHub
parent ff6b39e51b
commit be7f1df327
+5 -2
View File
@@ -112,7 +112,7 @@ use sp_runtime::{
self, CheckEqual, AtLeast32Bit, Zero, SignedExtension, Lookup, LookupError,
SimpleBitOps, Hash, Member, MaybeDisplay, BadOrigin, SaturatedConversion,
MaybeSerialize, MaybeSerializeDeserialize, MaybeMallocSizeOf, StaticLookup, One, Bounded,
Dispatchable, DispatchInfoOf, PostDispatchInfoOf,
Dispatchable, DispatchInfoOf, PostDispatchInfoOf, Printable,
},
offchain::storage_lock::BlockNumberProvider,
};
@@ -1591,7 +1591,10 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckWeight<T> where
// Since mandatory dispatched do not get validated for being overweight, we are sensitive
// to them actually being useful. Block producers are thus not allowed to include mandatory
// extrinsics that result in error.
if info.class == DispatchClass::Mandatory && result.is_err() {
if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) {
"Bad mandantory".print();
e.print();
Err(InvalidTransaction::BadMandatory)?
}