diff options
author | stickies-v <stickies-v@protonmail.com> | 2024-07-25 21:09:21 +0100 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2024-07-31 16:47:39 +0100 |
commit | 285ab50ace4c04209f331ccaf121152b977cc490 (patch) | |
tree | f4e5d58d27caafa9cd983fb1baf12b9ad37089ed /src | |
parent | 9a0b2a69c4d836d7382f6fe7703de40288fc7421 (diff) |
test: replace WtxidFromString with Wtxid::FromHex
The newly introduced Wtxid::FromHex is more robust and removes
the need for a WtxidFromString helper function
Diffstat (limited to 'src')
-rw-r--r-- | src/test/txpackage_tests.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/test/txpackage_tests.cpp b/src/test/txpackage_tests.cpp index f16c0cdafd..8997b95e80 100644 --- a/src/test/txpackage_tests.cpp +++ b/src/test/txpackage_tests.cpp @@ -43,13 +43,6 @@ inline CTransactionRef create_placeholder_tx(size_t num_inputs, size_t num_outpu } return MakeTransactionRef(mtx); } - -// Create a Wtxid from a hex string -inline Wtxid WtxidFromString(std::string_view str) -{ - return Wtxid::FromUint256(uint256S(str)); -} - BOOST_FIXTURE_TEST_CASE(package_hash_tests, TestChain100Setup) { // Random real segwit transaction @@ -74,9 +67,9 @@ BOOST_FIXTURE_TEST_CASE(package_hash_tests, TestChain100Setup) CTransactionRef ptx_3{MakeTransactionRef(tx_3)}; // It's easy to see that wtxids are sorted in lexicographical order: - Wtxid wtxid_1{WtxidFromString("0x85cd1a31eb38f74ed5742ec9cb546712ab5aaf747de28a9168b53e846cbda17f")}; - Wtxid wtxid_2{WtxidFromString("0xb4749f017444b051c44dfd2720e88f314ff94f3dd6d56d40ef65854fcd7fff6b")}; - Wtxid wtxid_3{WtxidFromString("0xe065bac15f62bb4e761d761db928ddee65a47296b2b776785abb912cdec474e3")}; + Wtxid wtxid_1{Wtxid::FromHex("85cd1a31eb38f74ed5742ec9cb546712ab5aaf747de28a9168b53e846cbda17f").value()}; + Wtxid wtxid_2{Wtxid::FromHex("b4749f017444b051c44dfd2720e88f314ff94f3dd6d56d40ef65854fcd7fff6b").value()}; + Wtxid wtxid_3{Wtxid::FromHex("e065bac15f62bb4e761d761db928ddee65a47296b2b776785abb912cdec474e3").value()}; BOOST_CHECK_EQUAL(tx_1.GetWitnessHash(), wtxid_1); BOOST_CHECK_EQUAL(tx_2.GetWitnessHash(), wtxid_2); BOOST_CHECK_EQUAL(tx_3.GetWitnessHash(), wtxid_3); |