Merge bitcoin/bitcoin#26934: test: Add unit test for ComputeTapleafHash

f34ada89fd Add unit test for ComputeTapleafHash (Greg Sanders)

Pull request description:

  Quick follow-up to https://github.com/bitcoin/bitcoin/pull/25877

ACKs for top commit:
  sipa:
    ACK f34ada89fd

Tree-SHA512: ebec658c9b33859874a3e5d13ca0a00a2484233f00f2da09c7d3fb47ed7f56fc6d476ddd0473fe1396a514dffd6ea6a200f26c6dbca45bac2473e729ffef04c2
This commit is contained in:
MarcoFalke 2023-01-20 16:25:17 +01:00
commit c0b6c40bb0
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -1827,4 +1827,14 @@ BOOST_AUTO_TEST_CASE(compute_tapbranch)
BOOST_CHECK_EQUAL(ComputeTapbranchHash(hash1, hash2), result);
}
BOOST_AUTO_TEST_CASE(compute_tapleaf)
{
const uint8_t script[6] = {'f','o','o','b','a','r'};
uint256 tlc0 = uint256S("edbc10c272a1215dcdcc11d605b9027b5ad6ed97cd45521203f136767b5b9c06");
uint256 tlc2 = uint256S("8b5c4f90ae6bf76e259dbef5d8a59df06359c391b59263741b25eca76451b27a");
BOOST_CHECK_EQUAL(ComputeTapleafHash(0xc0, Span(script)), tlc0);
BOOST_CHECK_EQUAL(ComputeTapleafHash(0xc2, Span(script)), tlc2);
}
BOOST_AUTO_TEST_SUITE_END()