Commit 6e5bb037 authored by Peter Goodspeed-Niklaus's avatar Peter Goodspeed-Niklaus
Browse files

improve warning when dropping inclusion inherent

- use the actual runtime `warn!` macro
- do not speculate about why the error occurred
- show the actual error returned
parent 69c9d091
......@@ -192,22 +192,24 @@ impl<T: Config> ProvideInherent for Module<T> {
)| {
// Sanity check: session changes can invalidate an inherent, and we _really_ don't want that to happen.
// See github.com/paritytech/polkadot/issues/1327
if Self::inclusion(
let (signed_bitfields, backed_candidates) = match Self::inclusion(
frame_system::RawOrigin::None.into(),
signed_bitfields.clone(),
backed_candidates.clone(),
parent_header.clone(),
)
.is_ok()
{
Call::inclusion(signed_bitfields, backed_candidates, parent_header)
} else {
sp_runtime::print(
"WARN: dropping signed_bitfields and backed_candidates because they produced \
an invalid inclusion inherent. Probably this is related to a session change."
);
Call::inclusion(Vec::new().into(), Vec::new(), parent_header)
}
) {
Ok(_) => (signed_bitfields, backed_candidates),
Err(err) => {
frame_support::debug::warn!(
target: "runtime_inclusion_inherent",
"dropping signed_bitfields and backed_candidates because they produced \
an invalid inclusion inherent: {:?}",
err,
);
(Vec::new().into(), Vec::new())
}
};
Call::inclusion(signed_bitfields, backed_candidates, parent_header)
}
)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment