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