mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 13:21:10 +00:00
Add warning when dropping inclusion inherent (#2261)
* Add warning when dropping inclusion inherent * 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 * BROKEN: add note if the current block matches the session start block This doesn't compile for a variety of reasons; this commit demonstrates what the issues are. I don't think this is an essential feature, so I'm stopping work on it here instead of pushing through it. * Revert "BROKEN: add note if the current block matches the session start block" This reverts commit eeb79ab7708ec94224fa60c9e1a46e12c18d52fd. * ensure a runtime logger exists before attempting to log a warning to it
This commit is contained in:
committed by
GitHub
parent
8b8185869e
commit
089ba85c32
@@ -196,18 +196,25 @@ impl<T: Config> ProvideInherent for Module<T> {
|
|||||||
)| {
|
)| {
|
||||||
// Sanity check: session changes can invalidate an inherent, and we _really_ don't want that to happen.
|
// Sanity check: session changes can invalidate an inherent, and we _really_ don't want that to happen.
|
||||||
// See github.com/paritytech/polkadot/issues/1327
|
// See github.com/paritytech/polkadot/issues/1327
|
||||||
if Self::inclusion(
|
let (signed_bitfields, backed_candidates) = match Self::inclusion(
|
||||||
frame_system::RawOrigin::None.into(),
|
frame_system::RawOrigin::None.into(),
|
||||||
signed_bitfields.clone(),
|
signed_bitfields.clone(),
|
||||||
backed_candidates.clone(),
|
backed_candidates.clone(),
|
||||||
parent_header.clone(),
|
parent_header.clone(),
|
||||||
)
|
) {
|
||||||
.is_ok()
|
Ok(_) => (signed_bitfields, backed_candidates),
|
||||||
{
|
Err(err) => {
|
||||||
Call::inclusion(signed_bitfields, backed_candidates, parent_header)
|
frame_support::debug::RuntimeLogger::init();
|
||||||
} else {
|
frame_support::debug::warn!(
|
||||||
Call::inclusion(Vec::new().into(), Vec::new(), parent_header)
|
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)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user