Skip to content

Commit f34ada8

Browse files
committed
Add unit test for ComputeTapleafHash
1 parent 392dc68 commit f34ada8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/script_tests.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,4 +1827,14 @@ BOOST_AUTO_TEST_CASE(compute_tapbranch)
18271827
BOOST_CHECK_EQUAL(ComputeTapbranchHash(hash1, hash2), result);
18281828
}
18291829

1830+
BOOST_AUTO_TEST_CASE(compute_tapleaf)
1831+
{
1832+
const uint8_t script[6] = {'f','o','o','b','a','r'};
1833+
uint256 tlc0 = uint256S("edbc10c272a1215dcdcc11d605b9027b5ad6ed97cd45521203f136767b5b9c06");
1834+
uint256 tlc2 = uint256S("8b5c4f90ae6bf76e259dbef5d8a59df06359c391b59263741b25eca76451b27a");
1835+
1836+
BOOST_CHECK_EQUAL(ComputeTapleafHash(0xc0, Span(script)), tlc0);
1837+
BOOST_CHECK_EQUAL(ComputeTapleafHash(0xc2, Span(script)), tlc2);
1838+
}
1839+
18301840
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)