mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 08:41:01 +00:00
frame_support::storage: Add StorageStreamIter (#12721)
* Save * Add some test * Yep * Move to its own file * More work * More * Finish implementation * Start resolving comments and fixing bugs * Fix all review comments * Update frame/support/src/storage/stream_iter.rs Co-authored-by: Koute <koute@users.noreply.github.com> * Update frame/support/src/storage/stream_iter.rs Co-authored-by: Koute <koute@users.noreply.github.com> * Review feedback * FMT * Okay, let's initialize the values... * Fix... Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -23,12 +23,13 @@ use sp_std::prelude::*;
|
||||
/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry.
|
||||
pub fn get<T: Decode + Sized>(key: &[u8]) -> Option<T> {
|
||||
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(|e| {
|
||||
// TODO #3700: error should be handleable.
|
||||
log::error!(
|
||||
target: "runtime::storage",
|
||||
"Corrupted state at {:?}",
|
||||
"Corrupted state at `{:?}: {:?}`",
|
||||
key,
|
||||
e,
|
||||
);
|
||||
None
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user