pub struct Stock;Expand description
The stock 80-byte Bitcoin header, hashed with double SHA-256 (parents
btc and tbtc4). Version 0x20000000, bit 31 clear, so a Knots node
never mistakes it for a v2 header. The stock header does not carry the
height, so beside a stock parent the coinbase is the only place the
height is written (coinbase_height).
Trait Implementations§
impl Copy for Stock
impl Eq for Stock
Source§impl HeaderFamily for Stock
impl HeaderFamily for Stock
Source§fn decode_header(&self, bytes: &[u8]) -> Result<Header>
fn decode_header(&self, bytes: &[u8]) -> Result<Header>
Exactly 80 bytes with bit 31 of the version clear; a set bit 31 is
refused as the kernel’s structVariants would select the v2 layout
for it (and as sidestr-header’s StockHeader::decode refuses it).
Source§fn version_number(&self, header: &Header) -> i64
fn version_number(&self, header: &Header) -> i64
i32le: bit 31 set reads as a negative version.
Source§const HEADER_LEN: usize = 80
const HEADER_LEN: usize = 80
The serialised header length: 80 or 164.
Source§type Block = Block
type Block = Block
The block: this header followed by the transactions.
bitcoin::Block
for the stock family; FamilyBlock otherwise.Source§fn block_hash(&self, header: &Header) -> BlockHash
fn block_hash(&self, header: &Header) -> BlockHash
The block hash: the parent’s proof-of-work hash over the header.
Source§fn signed_prefix(&self, header: &Header) -> Vec<u8> ⓘ
fn signed_prefix(&self, header: &Header) -> Vec<u8> ⓘ
The bytes the block signature commits to (SPEC 4): the header’s first
72 bytes, version, prev, merkle root and time on wire — never the nonce,
which is found after signing.
Source§fn header_height(&self, _header: &Header) -> Option<u32>
fn header_height(&self, _header: &Header) -> Option<u32>
The height the header itself carries, when the family writes it there.
Source§fn new_header(
&self,
prev: BlockHash,
merkle_root: TxMerkleNode,
time: u32,
bits: CompactTarget,
_height: u32,
_tx_count: usize,
) -> Header
fn new_header( &self, prev: BlockHash, merkle_root: TxMerkleNode, time: u32, bits: CompactTarget, _height: u32, _tx_count: usize, ) -> Header
An unsigned header on
prev with this family’s version and zero nonce
(siding/lib/block.mjs buildBlock). height and tx_count are for
the families whose header commits to them; the stock header ignores both.Source§fn merkle_root(&self, header: &Header) -> TxMerkleNode
fn merkle_root(&self, header: &Header) -> TxMerkleNode
The merkle root.
Source§fn time(&self, header: &Header) -> u32
fn time(&self, header: &Header) -> u32
The consensus time: for a v2 header, the wire time with its offset applied.
Source§fn bits(&self, header: &Header) -> CompactTarget
fn bits(&self, header: &Header) -> CompactTarget
The compact target.
Source§fn set_merkle_root(&self, header: &mut Header, root: TxMerkleNode)
fn set_merkle_root(&self, header: &mut Header, root: TxMerkleNode)
Replace the merkle root;
seal_block does so once the solution is in.Source§fn header_len(&self) -> usize
fn header_len(&self) -> usize
The serialised header length.
Source§fn header_rules(&self, header: &Self::Header, height: u32) -> Vec<RuleResult>
fn header_rules(&self, header: &Self::Header, height: u32) -> Vec<RuleResult>
The header rules the parent’s fork adds beyond Bitcoin’s (the Knots
overlay’s
knots:rule-header-*), judged for a header at height. None
for the stock family.Source§fn block_rules(&self, header: &Self::Header, tx_count: usize) -> Vec<RuleResult>
fn block_rules(&self, header: &Self::Header, tx_count: usize) -> Vec<RuleResult>
The block rules the parent’s fork adds (
knots:rule-block-txcount),
given the header and the block’s transaction count.Source§fn sighash_rules(&self, height: u32) -> SighashRules
fn sighash_rules(&self, height: u32) -> SighashRules
The signature-hash rules a spend at
height is judged by: BIP 341 on a
stock chain; Knots’ unified opt-in sighash from the fork height on a
BLAKE2b chain, which for a sidestr chain is height 0
(siding/lib/overlay.mjs: unifiedSighashParam: 'blake2bHeight',
blake2bHeight: 0).impl StructuralPartialEq for Stock
Auto Trait Implementations§
impl Freeze for Stock
impl RefUnwindSafe for Stock
impl Send for Stock
impl Sync for Stock
impl Unpin for Stock
impl UnsafeUnpin for Stock
impl UnwindSafe for Stock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.