Struct bitcoin_chain::blockchain::BlockchainNode
source · pub struct BlockchainNode {
pub block: Block,
pub total_work: Uint256,
pub required_difficulty: Uint256,
pub height: u32,
pub has_txdata: bool,
/* private fields */
}
Expand description
A link in the blockchain
Fields§
§block: Block
The actual block
total_work: Uint256
Total work from genesis to this point
required_difficulty: Uint256
Expected value of block.header.bits
for this block; only changes every
blockdata::constants::DIFFCHANGE_INTERVAL;
blocks
height: u32
Height above genesis
has_txdata: bool
Whether the transaction data is stored
Implementations§
source§impl BlockchainNode
impl BlockchainNode
sourcepub fn is_on_main_chain(&self, chain: &Blockchain) -> bool
pub fn is_on_main_chain(&self, chain: &Blockchain) -> bool
Is the node on the main chain?
Trait Implementations§
source§impl BitcoinHash for BlockchainNode
impl BitcoinHash for BlockchainNode
source§fn bitcoin_hash(&self) -> Sha256dHash
fn bitcoin_hash(&self) -> Sha256dHash
Produces a Sha256dHash which can be used to refer to the object
source§impl<D: SimpleDecoder> ConsensusDecodable<D> for BlockchainNode
impl<D: SimpleDecoder> ConsensusDecodable<D> for BlockchainNode
source§fn consensus_decode(d: &mut D) -> Result<BlockchainNode, Error>where
D: SimpleDecoder,
fn consensus_decode(d: &mut D) -> Result<BlockchainNode, Error>where
D: SimpleDecoder,
Decode an object with a well-defined format
source§impl<S: SimpleEncoder> ConsensusEncodable<S> for BlockchainNode
impl<S: SimpleEncoder> ConsensusEncodable<S> for BlockchainNode
source§fn consensus_encode(&self, s: &mut S) -> Result<(), Error>where
S: SimpleEncoder,
fn consensus_encode(&self, s: &mut S) -> Result<(), Error>where
S: SimpleEncoder,
Encode an object with a well-defined format