- Companion:
- class
- Source:
- MerkleBlock.scala
Type members
Inherited types
The names of the product elements
The names of the product elements
- Inherited from:
- Mirror
- Source:
- Mirror.scala
Value members
Concrete methods
- Value parameters:
- height
tree height (0 == bottom == leaf nodes)
- leafCount
total number of leaf nodes
- Returns:
the number of nodes at the given height
- Source:
- MerkleBlock.scala
compute the root hash of a partial merkle tree: Read a bit from the flag bit list: If it is '0': Read a hash from the hashes list, and return it as this node's hash. If it is '1' and this is a leaf node: Read a hash from the hashes list, store it as a matched txid, and return it as this node's hash. If it is '1' and this is an internal node: Descend into its left child tree, and store its computed hash as L. If this node has a right child as well: Descend into its right child, and store its computed hash as R. If L == R, the partial merkle tree object is invalid. Return Hash(L || R). If this node has no right child, return Hash(L || L).
compute the root hash of a partial merkle tree: Read a bit from the flag bit list: If it is '0': Read a hash from the hashes list, and return it as this node's hash. If it is '1' and this is a leaf node: Read a hash from the hashes list, store it as a matched txid, and return it as this node's hash. If it is '1' and this is an internal node: Descend into its left child tree, and store its computed hash as L. If this node has a right child as well: Descend into its right child, and store its computed hash as R. If L == R, the partial merkle tree object is invalid. Return Hash(L || R). If this node has no right child, return Hash(L || L).
- Value parameters:
- bits
remaining flag bits to read from
- count
total number of leaves
- hashes
remaining hashes to read from
- height
current height (0 == bottom of the tree == leaf nodes)
- pos
current position at this height, 0 = first node from the left
- Returns:
a (hash, matched, remaining_hashes, remaining_bits) tuple where:
- hash is the hash at position (height, pos)
- matched is a list of matched txids and their position in the original block
- remaining_hashes and remaining_bits are hashes and bits that have not been used
- Source:
- MerkleBlock.scala
- Value parameters:
- leafCount
ttoal number of leaf nodes
- Returns:
the height of the root node. For example if yo have 5 leaf nodes, the height of the root node is 3.
- Source:
- MerkleBlock.scala
Inherited methods
read a message from a hex string
read a message from a hex string
- Value parameters:
- in
message binary data in hex format
- Returns:
a deserialized message of type T
- Inherited from:
- BtcSerializer
- Source:
- Protocol.scala
read a message from a byte array
read a message from a byte array
- Value parameters:
- in
serialized message
- Returns:
a deserialized message
- Inherited from:
- BtcSerializer
- Source:
- Protocol.scala
write a message to a byte array
write a message to a byte array
- Value parameters:
- t
message
- Returns:
a serialized message
- Inherited from:
- BtcSerializer
- Source:
- Protocol.scala