mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 18:41:01 +00:00
frame-support: Use logging for printing corrupted state (#10612)
`runtime_print!` is printed by default using `debug`, aka not being visible. With `log::error!` it will be printed directly to the user. Production networks like Polkadot disable logging, but for them we run special nodes that have logging enabled.
This commit is contained in:
@@ -34,8 +34,9 @@ pub fn get<T: Decode + Sized>(child_info: &ChildInfo, key: &[u8]) -> Option<T> {
|
|||||||
sp_io::default_child_storage::get(storage_key, key).and_then(|v| {
|
sp_io::default_child_storage::get(storage_key, key).and_then(|v| {
|
||||||
Decode::decode(&mut &v[..]).map(Some).unwrap_or_else(|_| {
|
Decode::decode(&mut &v[..]).map(Some).unwrap_or_else(|_| {
|
||||||
// TODO #3700: error should be handleable.
|
// TODO #3700: error should be handleable.
|
||||||
crate::runtime_print!(
|
log::error!(
|
||||||
"ERROR: Corrupted state in child trie at {:?}/{:?}",
|
target: "runtime::storage",
|
||||||
|
"Corrupted state in child trie at {:?}/{:?}",
|
||||||
storage_key,
|
storage_key,
|
||||||
key,
|
key,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ pub fn get<T: Decode + Sized>(key: &[u8]) -> Option<T> {
|
|||||||
sp_io::storage::get(key).and_then(|val| {
|
sp_io::storage::get(key).and_then(|val| {
|
||||||
Decode::decode(&mut &val[..]).map(Some).unwrap_or_else(|_| {
|
Decode::decode(&mut &val[..]).map(Some).unwrap_or_else(|_| {
|
||||||
// TODO #3700: error should be handleable.
|
// TODO #3700: error should be handleable.
|
||||||
crate::runtime_print!("ERROR: Corrupted state at {:?}", key);
|
log::error!(
|
||||||
|
target: "runtime::storage",
|
||||||
|
"Corrupted state at {:?}",
|
||||||
|
key,
|
||||||
|
);
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user