BlockId removal: refactor: Finalizer (#12528)

* BlockId removal: refactor: Finalizer

It changes the arguments of methods of `Finalizer` trait from:
block: `BlockId<Block>` to: hash: `&Block::Hash`

This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)

* minor corrections

* failing test corrected

* minor rework
This commit is contained in:
Michal Kucharczyk
2022-10-20 08:44:04 +02:00
committed by GitHub
parent 7aadc2aa3c
commit 749bcd1949
16 changed files with 113 additions and 118 deletions
+12 -2
View File
@@ -1457,7 +1457,12 @@ fn grandpa_environment_respects_voting_rules() {
);
// we finalize block 19 with block 21 being the best block
peer.client().finalize_block(BlockId::Number(19), None, false).unwrap();
let hashof19 = peer
.client()
.as_client()
.expect_block_hash_from_id(&BlockId::Number(19))
.unwrap();
peer.client().finalize_block(&hashof19, None, false).unwrap();
// the 3/4 environment should propose block 21 for voting
assert_eq!(
@@ -1479,7 +1484,12 @@ fn grandpa_environment_respects_voting_rules() {
);
// we finalize block 21 with block 21 being the best block
peer.client().finalize_block(BlockId::Number(21), None, false).unwrap();
let hashof21 = peer
.client()
.as_client()
.expect_block_hash_from_id(&BlockId::Number(21))
.unwrap();
peer.client().finalize_block(&hashof21, None, false).unwrap();
// even though the default environment will always try to not vote on the
// best block, there's a hard rule that we can't cast any votes lower than