Changeset View
Changeset View
Standalone View
Standalone View
src/merkleblock.h
Show All 18 Lines | |||||
* It represents a subset of the txid's of a known block, in a way that | * It represents a subset of the txid's of a known block, in a way that | ||||
* allows recovery of the list of txid's and the merkle root, in an | * allows recovery of the list of txid's and the merkle root, in an | ||||
* authenticated way. | * authenticated way. | ||||
* | * | ||||
* The encoding works as follows: we traverse the tree in depth-first order, | * The encoding works as follows: we traverse the tree in depth-first order, | ||||
* storing a bit for each traversed node, signifying whether the node is the | * storing a bit for each traversed node, signifying whether the node is the | ||||
* parent of at least one matched leaf txid (or a matched txid itself). In | * parent of at least one matched leaf txid (or a matched txid itself). In | ||||
* case we are at the leaf level, or this bit is 0, its merkle node hash is | * case we are at the leaf level, or this bit is 0, its merkle node hash is | ||||
* stored, and its children are not explorer further. Otherwise, no hash is | * stored, and its children are not explored further. Otherwise, no hash is | ||||
* stored, but we recurse into both (or the only) child branch. During | * stored, but we recurse into both (or the only) child branch. During | ||||
* decoding, the same depth-first traversal is performed, consuming bits and | * decoding, the same depth-first traversal is performed, consuming bits and | ||||
* hashes as they written during encoding. | * hashes as they written during encoding. | ||||
* | * | ||||
* The serialization is fixed and provides a hard guarantee about the | * The serialization is fixed and provides a hard guarantee about the | ||||
* encoded size: | * encoded size: | ||||
* | * | ||||
* SIZE <= 10 + ceil(32.25*N) | * SIZE <= 10 + ceil(32.25*N) | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |