New implementation of incremental merkle tree

This is a new implementation of the incremental merkle tree used by our
scheme to witness commitments to spendable value. It serves as a fixed-sized
accumulator.

This new construction has a much simpler API surface area, avoids memory
safety issues, remains pruned at all times, avoids serialization edge cases,
has more efficient insertion, and is abstract over the depth and hash
function used at the type level.

Further, it lays the groundwork for efficient "fast-forwarding" of witnesses
into the tree as the treestate is updated.
This commit is contained in:
Sean Bowe
2016-03-28 02:40:21 -06:00
parent 291b191bd7
commit e1ff849d8d
12 changed files with 889 additions and 5 deletions

View File

@@ -25,7 +25,11 @@ JSON_TEST_FILES = \
test/data/script_invalid.json \
test/data/tx_invalid.json \
test/data/tx_valid.json \
test/data/sighash.json
test/data/sighash.json \
test/data/merkle_roots.json \
test/data/merkle_serialization.json \
test/data/merkle_witness_serialization.json \
test/data/merkle_path.json
RAW_TEST_FILES = test/data/alertTests.raw
@@ -78,7 +82,8 @@ BITCOIN_TESTS =\
test/uint256_tests.cpp \
test/univalue_tests.cpp \
test/util_tests.cpp \
test/sha256compress_tests.cpp
test/sha256compress_tests.cpp \
test/merkle_tests.cpp
if ENABLE_WALLET
BITCOIN_TESTS += \