blockchain info
This commit is contained in:
parent
b6d1801e12
commit
beb33672bd
@ -44,6 +44,7 @@ use receipt::LocalizedReceipt;
|
|||||||
pub use blockchain::CacheSize as BlockChainCacheSize;
|
pub use blockchain::CacheSize as BlockChainCacheSize;
|
||||||
use trace::{TraceDB, ImportRequest as TraceImportRequest, LocalizedTrace, Database as TraceDatabase};
|
use trace::{TraceDB, ImportRequest as TraceImportRequest, LocalizedTrace, Database as TraceDatabase};
|
||||||
use trace;
|
use trace;
|
||||||
|
pub use types::blockchain_info::BlockChainInfo;
|
||||||
|
|
||||||
/// General block status
|
/// General block status
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
@ -58,21 +59,6 @@ pub enum BlockStatus {
|
|||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information about the blockchain gathered together.
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct BlockChainInfo {
|
|
||||||
/// Blockchain difficulty.
|
|
||||||
pub total_difficulty: U256,
|
|
||||||
/// Block queue difficulty.
|
|
||||||
pub pending_total_difficulty: U256,
|
|
||||||
/// Genesis block hash.
|
|
||||||
pub genesis_hash: H256,
|
|
||||||
/// Best blockchain block hash.
|
|
||||||
pub best_block_hash: H256,
|
|
||||||
/// Best blockchain block number.
|
|
||||||
pub best_block_number: BlockNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for BlockChainInfo {
|
impl fmt::Display for BlockChainInfo {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "#{}.{}", self.best_block_number, self.best_block_hash)
|
write!(f, "#{}.{}", self.best_block_number, self.best_block_hash)
|
||||||
|
33
ethcore/src/types/blockchain_info.rs
Normal file
33
ethcore/src/types/blockchain_info.rs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use util::*;
|
||||||
|
use header::BlockNumber;
|
||||||
|
|
||||||
|
/// Information about the blockchain gathered together.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct BlockChainInfo {
|
||||||
|
/// Blockchain difficulty.
|
||||||
|
pub total_difficulty: U256,
|
||||||
|
/// Block queue difficulty.
|
||||||
|
pub pending_total_difficulty: U256,
|
||||||
|
/// Genesis block hash.
|
||||||
|
pub genesis_hash: H256,
|
||||||
|
/// Best blockchain block hash.
|
||||||
|
pub best_block_hash: H256,
|
||||||
|
/// Best blockchain block number.
|
||||||
|
pub best_block_number: BlockNumber
|
||||||
|
}
|
@ -20,3 +20,4 @@ pub mod transaction;
|
|||||||
pub mod ids;
|
pub mod ids;
|
||||||
pub mod receipt;
|
pub mod receipt;
|
||||||
pub mod tree_route;
|
pub mod tree_route;
|
||||||
|
pub mod blockchain_info;
|
||||||
|
Loading…
Reference in New Issue
Block a user