Struct blocks_iterator::BlockExtra
source · pub struct BlockExtra {
pub version: u8,
pub block: Block,
pub block_hash: BlockHash,
pub size: u32,
pub next: Vec<BlockHash>,
pub height: u32,
pub outpoint_values: HashMap<OutPoint, TxOut>,
pub block_total_inputs: u32,
pub block_total_outputs: u32,
pub txids: Vec<Txid>,
}
Expand description
The bitcoin block and additional metadata returned by the crate::iter() method
Fields§
§version: u8
Serialization format version
block: Block
The bitcoin block
block_hash: BlockHash
The bitcoin block hash, same as block.block_hash()
but result from hashing is cached
size: u32
The byte size of the block, as returned by in serialize(block).len()
next: Vec<BlockHash>
Hash of the blocks following this one, it’s a vec because during reordering they may be more than one because of reorgs, as a result from the iteration, it’s just one.
height: u32
The height of the current block, number of blocks between this one and the genesis block
outpoint_values: HashMap<OutPoint, TxOut>
All the previous outputs of this block. Allowing to validate the script or computing the fee
Note that when configuration skip_script_pubkey
is true, the script is empty,
when skip_prevout
is true, this map is empty.
block_total_inputs: u32
Total number of transaction inputs in this block
block_total_outputs: u32
Total number of transaction outputs in this block
txids: Vec<Txid>
Precomputed transaction hashes such that txids[i]=block.txdata[i].txid()
Implementations§
source§impl BlockExtra
impl BlockExtra
sourcepub fn average_fee(&self) -> Option<f64>
pub fn average_fee(&self) -> Option<f64>
Returns the average transaction fee in the block
sourcepub fn tx_fee(&self, tx: &Transaction) -> Option<u64>
pub fn tx_fee(&self, tx: &Transaction) -> Option<u64>
Returns the fee of a transaction contained in the block
sourcepub fn base_reward(&self) -> u64
pub fn base_reward(&self) -> u64
Return the base block reward in satoshi
sourcepub fn iter_tx(&self) -> impl Iterator<Item = (&Txid, &Transaction)>
pub fn iter_tx(&self) -> impl Iterator<Item = (&Txid, &Transaction)>
Iterate transactions of blocks together with their txids
Trait Implementations§
source§impl Debug for BlockExtra
impl Debug for BlockExtra
source§impl Decodable for BlockExtra
impl Decodable for BlockExtra
source§impl Encodable for BlockExtra
impl Encodable for BlockExtra
source§impl PartialEq<BlockExtra> for BlockExtra
impl PartialEq<BlockExtra> for BlockExtra
source§fn eq(&self, other: &BlockExtra) -> bool
fn eq(&self, other: &BlockExtra) -> bool
self
and other
values to be equal, and is used
by ==
.