Use storage_root of newly calculated header (#2216)

Instead of calculating the `storage_root` a second time, we just can
take the `storage_root` from the new header.
This commit is contained in:
Bastian Köcher
2019-04-05 18:50:38 +02:00
committed by André Silva
parent b01136c90d
commit dce0b4ea49
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_name: create_runtime_str!("substrate-node"),
authoring_version: 10,
spec_version: 57,
impl_version: 58,
impl_version: 59,
apis: RUNTIME_API_VERSIONS,
};
+3 -3
View File
@@ -23,7 +23,7 @@ use rstd::marker::PhantomData;
use rstd::result;
use primitives::traits::{
self, Header, Zero, One, Checkable, Applyable, CheckEqual, OnFinalize,
OnInitialize, Hash, As, Digest, NumberFor, Block as BlockT, OffchainWorker
OnInitialize, As, Digest, NumberFor, Block as BlockT, OffchainWorker
};
use srml_support::{Dispatchable, traits::MakePayment};
use parity_codec::{Codec, Encode};
@@ -238,9 +238,9 @@ impl<
}
// check storage root.
let storage_root = System::Hashing::storage_root();
let storage_root = new_header.state_root();
header.state_root().check_equal(&storage_root);
assert!(header.state_root() == &storage_root, "Storage root must match that calculated.");
assert!(header.state_root() == storage_root, "Storage root must match that calculated.");
}
/// Check a given transaction for validity. This doesn't execute any