Child trie api changes BREAKING (#4857)

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
cheme
2020-04-20 15:21:22 +02:00
committed by GitHub
parent 7d9aa81bfc
commit 4ffcf98d8d
64 changed files with 1514 additions and 1655 deletions
+4 -4
View File
@@ -136,15 +136,15 @@ impl BuildStorage for sp_core::storage::Storage {
storage: &mut sp_core::storage::Storage,
)-> Result<(), String> {
storage.top.extend(self.top.iter().map(|(k, v)| (k.clone(), v.clone())));
for (k, other_map) in self.children.iter() {
for (k, other_map) in self.children_default.iter() {
let k = k.clone();
if let Some(map) = storage.children.get_mut(&k) {
if let Some(map) = storage.children_default.get_mut(&k) {
map.data.extend(other_map.data.iter().map(|(k, v)| (k.clone(), v.clone())));
if !map.child_info.try_update(other_map.child_info.as_ref()) {
if !map.child_info.try_update(&other_map.child_info) {
return Err("Incompatible child info update".to_string());
}
} else {
storage.children.insert(k, other_map.clone());
storage.children_default.insert(k, other_map.clone());
}
}
Ok(())