Switch blocks to a constant-space Merkle root/branch algorithm.
commiteece63fa72566068cb2a1bf85c95a72a5ba59bc9
authorPieter Wuille <pieter.wuille@gmail.com>
Tue, 17 Nov 2015 16:35:44 +0000 (17 17:35 +0100)
committerPieter Wuille <pieter.wuille@gmail.com>
Fri, 27 Nov 2015 14:36:52 +0000 (27 15:36 +0100)
tree093633b56700e77f3bc4d8fda2b3032d2aa7c4dd
parentee60e5625bf8a11c8e5509b9cea8b6465056c448
Switch blocks to a constant-space Merkle root/branch algorithm.

This switches the Merkle tree logic for blocks to one that runs in constant (small) space.
The old code is moved to tests, and a new test is added that for various combinations of
block sizes, transaction positions to compute a branch for, and mutations:
 * Verifies that the old code and new code agree for the Merkle root.
 * Verifies that the old code and new code agree for the Merkle branch.
 * Verifies that the computed Merkle branch is valid.
 * Verifies that mutations don't change the Merkle root.
 * Verifies that mutations are correctly detected.
12 files changed:
src/Makefile.test.include
src/chainparams.cpp
src/consensus/merkle.cpp
src/consensus/merkle.h
src/main.cpp
src/miner.cpp
src/primitives/block.cpp
src/primitives/block.h
src/test/main_tests.cpp
src/test/merkle_tests.cpp [new file with mode: 0644]
src/test/miner_tests.cpp
src/test/pmt_tests.cpp