mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 07:55:45 +00:00
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:
committed by
GitHub
parent
8b8675df23
commit
84167bd7d4
+13
-8
@@ -26,7 +26,7 @@ use log::{debug, trace};
|
||||
use sc_client_api::BlockBackend;
|
||||
use sc_network::{config as netconfig, config::RequestResponseConfig, PeerId, ReputationChange};
|
||||
use sc_network_common::protocol::ProtocolName;
|
||||
use sp_runtime::{generic::BlockId, traits::Block};
|
||||
use sp_runtime::traits::Block;
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
use crate::communication::request_response::{
|
||||
@@ -149,13 +149,18 @@ where
|
||||
fn handle_request(&self, request: IncomingRequest<B>) -> Result<(), Error> {
|
||||
// TODO (issue #12293): validate `request` and change peer reputation for invalid requests.
|
||||
|
||||
let maybe_encoded_proof = self
|
||||
.client
|
||||
.justifications(&BlockId::Number(request.payload.begin))
|
||||
.map_err(Error::Client)?
|
||||
.and_then(|justifs| justifs.get(BEEFY_ENGINE_ID).cloned())
|
||||
// No BEEFY justification present.
|
||||
.ok_or(());
|
||||
let maybe_encoded_proof = if let Some(hash) =
|
||||
self.client.block_hash(request.payload.begin).map_err(Error::Client)?
|
||||
{
|
||||
self.client
|
||||
.justifications(&hash)
|
||||
.map_err(Error::Client)?
|
||||
.and_then(|justifs| justifs.get(BEEFY_ENGINE_ID).cloned())
|
||||
// No BEEFY justification present.
|
||||
.ok_or(())
|
||||
} else {
|
||||
Err(())
|
||||
};
|
||||
|
||||
request
|
||||
.pending_response
|
||||
|
||||
Reference in New Issue
Block a user