mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-08-03 10:25:40 +00:00
committed by
Robert Habermeier
parent
052c50b536
commit
d978425f05
@@ -119,6 +119,8 @@ pub enum BlockOrigin {
|
||||
/// Summary of an imported block
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BlockImportNotification {
|
||||
/// Imported block header hash.
|
||||
pub hash: block::HeaderHash,
|
||||
/// Imported block origin.
|
||||
pub origin: BlockOrigin,
|
||||
/// Imported block header.
|
||||
@@ -312,13 +314,15 @@ impl<B, E> Client<B, E> where
|
||||
)?;
|
||||
|
||||
let is_new_best = header.number == self.backend.blockchain().info()?.best_number + 1;
|
||||
trace!("Imported {}, (#{}), best={}", block::HeaderHash::from(header.blake2_256()), header.number, is_new_best);
|
||||
let hash: block::HeaderHash = header.blake2_256().into();
|
||||
trace!("Imported {}, (#{}), best={}", hash, header.number, is_new_best);
|
||||
transaction.set_block_data(header.clone(), body, Some(justification.uncheck().into()), is_new_best)?;
|
||||
transaction.set_storage(overlay.drain())?;
|
||||
self.backend.commit_operation(transaction)?;
|
||||
|
||||
if origin == BlockOrigin::NetworkBroadcast || origin == BlockOrigin::Own || origin == BlockOrigin::ConsensusBroadcast {
|
||||
let notification = BlockImportNotification {
|
||||
hash: hash,
|
||||
origin: origin,
|
||||
header: header,
|
||||
is_new_best: is_new_best,
|
||||
|
||||
@@ -59,7 +59,8 @@ pub mod error;
|
||||
|
||||
#[cfg(test)] mod test;
|
||||
|
||||
pub use service::{Service, FetchFuture, StatementStream, ConsensusService, BftMessageStream, TransactionPool, Params, ManageNetwork};
|
||||
pub use service::{Service, FetchFuture, StatementStream, ConsensusService, BftMessageStream,
|
||||
TransactionPool, Params, ManageNetwork, SyncProvider};
|
||||
pub use protocol::{ProtocolStatus};
|
||||
pub use sync::{Status as SyncStatus, SyncState};
|
||||
pub use network::{NonReservedPeerMode, NetworkConfiguration};
|
||||
|
||||
Reference in New Issue
Block a user