Do not return empty entries from state_queryStorage (#2906)

* do not return empty entries from state_queryStorage

* revert back None -> null change

* Revert "revert back None -> null change"

This reverts commit 318eb043e03b7aabbc3f176e02c15fd4595d16db.
This commit is contained in:
Svyatoslav Nikolsky
2019-06-19 16:31:14 +03:00
committed by Bastian Köcher
parent 828485ec08
commit 5030097799
6 changed files with 65 additions and 31 deletions
@@ -238,6 +238,7 @@ fn execute_transaction_backend(utx: &Extrinsic) -> ApplyResult {
Extrinsic::Transfer(ref transfer, _) => execute_transfer_backend(transfer),
Extrinsic::AuthoritiesChange(ref new_auth) => execute_new_authorities_backend(new_auth),
Extrinsic::IncludeData(_) => Ok(ApplyOutcome::Success),
Extrinsic::StorageChange(key, value) => execute_storage_change(key, value.as_ref().map(|v| &**v)),
}
}
@@ -273,6 +274,14 @@ fn execute_new_authorities_backend(new_authorities: &[AuthorityId]) -> ApplyResu
Ok(ApplyOutcome::Success)
}
fn execute_storage_change(key: &[u8], value: Option<&[u8]>) -> ApplyResult {
match value {
Some(value) => storage::unhashed::put_raw(key, value),
None => storage::unhashed::kill(key),
}
Ok(ApplyOutcome::Success)
}
#[cfg(feature = "std")]
fn info_expect_equal_hash(given: &Hash, expected: &Hash) {
use primitives::hexdisplay::HexDisplay;