BlockId removal: refactor: Backend::justifications (#12602)

* BlockId removal: refactor: Backend::justifications

It changes the arguments of `Backend::justifications` method from: `BlockId<Block>` to: `&Block::Hash`

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

* trigger CI job

* trigger CI job

* bug fix

* match -> if

Co-authored-by: Adrian Catangiu <adrian@parity.io>

Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
Michal Kucharczyk
2022-11-02 23:15:33 +01:00
committed by GitHub
parent 8b8675df23
commit 84167bd7d4
16 changed files with 89 additions and 102 deletions
+6 -4
View File
@@ -741,9 +741,9 @@ fn beefy_importing_blocks() {
let full_client = client.as_client();
let parent_id = BlockId::Number(0);
let block_id = BlockId::Number(1);
let builder = full_client.new_block_at(&parent_id, Default::default(), false).unwrap();
let block = builder.build().unwrap().block;
let hashof1 = block.header.hash();
// Import without justifications.
let mut justif_recv = justif_stream.subscribe();
@@ -760,7 +760,7 @@ fn beefy_importing_blocks() {
// none in backend,
assert_eq!(
full_client
.justifications(&block_id)
.justifications(&hashof1)
.unwrap()
.and_then(|j| j.get(BEEFY_ENGINE_ID).cloned()),
None
@@ -784,6 +784,7 @@ fn beefy_importing_blocks() {
let builder = full_client.new_block_at(&parent_id, Default::default(), false).unwrap();
let block = builder.build().unwrap().block;
let hashof2 = block.header.hash();
let mut justif_recv = justif_stream.subscribe();
assert_eq!(
block_on(block_import.import_block(params(block, justif), HashMap::new())).unwrap(),
@@ -798,7 +799,7 @@ fn beefy_importing_blocks() {
// still not in backend (worker is responsible for appending to backend),
assert_eq!(
full_client
.justifications(&block_id)
.justifications(&hashof2)
.unwrap()
.and_then(|j| j.get(BEEFY_ENGINE_ID).cloned()),
None
@@ -826,6 +827,7 @@ fn beefy_importing_blocks() {
let builder = full_client.new_block_at(&parent_id, Default::default(), false).unwrap();
let block = builder.build().unwrap().block;
let hashof3 = block.header.hash();
let mut justif_recv = justif_stream.subscribe();
assert_eq!(
block_on(block_import.import_block(params(block, justif), HashMap::new())).unwrap(),
@@ -841,7 +843,7 @@ fn beefy_importing_blocks() {
// none in backend,
assert_eq!(
full_client
.justifications(&BlockId::Number(block_num))
.justifications(&hashof3)
.unwrap()
.and_then(|j| j.get(BEEFY_ENGINE_ID).cloned()),
None