Check the genesis hash in transactions regardless of era. (#3286)

* Check the genesis hash in transactions regardless of era.

* Fix check-fees, too.

* Undo.

* Subkey supports new signing.

* Remove unneeded type param.

* Bump tx version

* Build.

* Another build fix

* Build again

* Cleanup

* Another fix.

* Fix

* Fixes

* 6 second blocks.

* Fixes

* Build fix

* Fix

* Fix.
This commit is contained in:
Gavin Wood
2019-08-02 18:30:20 +02:00
committed by GitHub
parent ae6c2f7f8c
commit 7927e80bc6
16 changed files with 102 additions and 116 deletions
+4 -29
View File
@@ -35,9 +35,8 @@ use consensus::{
SelectChain, self,
};
use sr_primitives::traits::{
Block as BlockT, Header as HeaderT, Zero, NumberFor, CurrentHeight,
BlockNumberToHash, ApiRef, ProvideRuntimeApi,
SaturatedConversion, One, DigestFor,
Block as BlockT, Header as HeaderT, Zero, NumberFor,
ApiRef, ProvideRuntimeApi, SaturatedConversion, One, DigestFor,
};
use sr_primitives::generic::DigestItem;
use sr_primitives::BuildStorage;
@@ -1521,30 +1520,6 @@ impl<B, E, Block, RA> consensus::BlockImport<Block> for Client<B, E, Block, RA>
}
}
impl<B, E, Block, RA> CurrentHeight for Client<B, E, Block, RA> where
B: backend::Backend<Block, Blake2Hasher>,
E: CallExecutor<Block, Blake2Hasher>,
Block: BlockT<Hash=H256>,
{
type BlockNumber = <Block::Header as HeaderT>::Number;
fn current_height(&self) -> Self::BlockNumber {
self.backend.blockchain().info().best_number
}
}
impl<B, E, Block, RA> BlockNumberToHash for Client<B, E, Block, RA> where
B: backend::Backend<Block, Blake2Hasher>,
E: CallExecutor<Block, Blake2Hasher>,
Block: BlockT<Hash=H256>,
{
type BlockNumber = <Block::Header as HeaderT>::Number;
type Hash = Block::Hash;
fn block_number_to_hash(&self, n: Self::BlockNumber) -> Option<Self::Hash> {
self.block_hash(n).unwrap_or(None)
}
}
impl<B, E, Block, RA> BlockchainEvents<Block> for Client<B, E, Block, RA>
where
E: CallExecutor<Block, Blake2Hasher>,
@@ -2698,7 +2673,7 @@ pub(crate) mod tests {
let current_balance = ||
client.runtime_api().balance_of(
&BlockId::number(client.current_height()), AccountKeyring::Alice.into()
&BlockId::number(client.info().chain.best_number), AccountKeyring::Alice.into()
).unwrap();
// G -> A1 -> A2
@@ -2745,7 +2720,7 @@ pub(crate) mod tests {
let current_balance = ||
client.runtime_api().balance_of(
&BlockId::number(client.current_height()), AccountKeyring::Alice.into()
&BlockId::number(client.info().chain.best_number), AccountKeyring::Alice.into()
).unwrap();
// G -> A1