Struct bitcoin::blockdata::blockchain::Blockchain
[−]
[src]
pub struct Blockchain { /* fields omitted */ }
The blockchain
Methods
impl Blockchain
[src]
fn new(network: Network) -> Blockchain
[src]
Constructs a new blockchain
fn get_block(&self, hash: Sha256dHash) -> Option<&BlockchainNode>
[src]
Looks up a block in the chain and returns the BlockchainNode containing it
fn add_txdata(&mut self, block: Block) -> Result<(), Error>
[src]
Locates a block in the chain and overwrites its txdata
fn remove_txdata(&mut self, hash: Sha256dHash) -> Result<(), Error>
[src]
Locates a block in the chain and removes its txdata
fn add_header(&mut self, header: BlockHeader) -> Result<(), Error>
[src]
Adds a block header to the chain
fn add_block(&mut self, block: Block) -> Result<(), Error>
[src]
Adds a block to the chain
fn genesis_hash(&self) -> Sha256dHash
[src]
Returns the genesis block's blockhash
fn best_tip(&self) -> &Block
[src]
Returns the best tip
fn best_tip_hash(&self) -> Sha256dHash
[src]
Returns the best tip's blockhash
fn locator_hashes(&self) -> Vec<Sha256dHash>
[src]
Returns an array of locator hashes used in getheaders
messages
fn iter(&self, start_hash: Sha256dHash) -> BlockIter
[src]
An iterator over all blocks in the chain starting from start_hash
fn rev_iter(&self, start_hash: Sha256dHash) -> RevBlockIter
[src]
An iterator over all blocks in reverse order to the genesis, starting with start_hash
fn rev_stale_iter(&self, start_hash: Sha256dHash) -> RevStaleBlockIter
[src]
An iterator over all blocks -not- in the best chain, in reverse order, starting from start_hash
Trait Implementations
impl<S: SimpleEncoder> ConsensusEncodable<S> for Blockchain
[src]
fn consensus_encode(&self, s: &mut S) -> Result<(), S::Error>
[src]
Encode an object with a well-defined format
impl<D: SimpleDecoder> ConsensusDecodable<D> for Blockchain
[src]
fn consensus_decode(d: &mut D) -> Result<Blockchain, D::Error>
[src]
Decode an object with a well-defined format