mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 04:21:01 +00:00
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:
committed by
André Silva
parent
b01136c90d
commit
dce0b4ea49
@@ -60,7 +60,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
impl_name: create_runtime_str!("substrate-node"),
|
impl_name: create_runtime_str!("substrate-node"),
|
||||||
authoring_version: 10,
|
authoring_version: 10,
|
||||||
spec_version: 57,
|
spec_version: 57,
|
||||||
impl_version: 58,
|
impl_version: 59,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use rstd::marker::PhantomData;
|
|||||||
use rstd::result;
|
use rstd::result;
|
||||||
use primitives::traits::{
|
use primitives::traits::{
|
||||||
self, Header, Zero, One, Checkable, Applyable, CheckEqual, OnFinalize,
|
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 srml_support::{Dispatchable, traits::MakePayment};
|
||||||
use parity_codec::{Codec, Encode};
|
use parity_codec::{Codec, Encode};
|
||||||
@@ -238,9 +238,9 @@ impl<
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check storage root.
|
// check storage root.
|
||||||
let storage_root = System::Hashing::storage_root();
|
let storage_root = new_header.state_root();
|
||||||
header.state_root().check_equal(&storage_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
|
/// Check a given transaction for validity. This doesn't execute any
|
||||||
|
|||||||
Reference in New Issue
Block a user