aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-09-27 11:26:17 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-09-27 11:26:29 -0400
commit01211cea71016ceadfcbe98a8ec660a5071bd82e (patch)
tree953e2498b0a08ef1a959d616c86c9a6d382bd3e1 /src/test
parent423cb37658b81b2cb8475b6fdb08b3122fee51a4 (diff)
parent9c5af58d51cea7d0cf2a598a9979eeba103b23ff (diff)
downloadbitcoin-01211cea71016ceadfcbe98a8ec660a5071bd82e.tar.xz
Merge #14307: Consolidate redundant implementations of ParseHashStr
9c5af58d51 Consolidate redundant implementations of ParseHashStr (Ben Woosley) Pull request description: This change: * adds a length check to all calls to `ParseHashStr`, appropriate given its use to populate a 256-bit number from a hex str * allows the caller to handle the failure, which allows for the more appropriate `JSONRPCError` on failure in `prioritisetransaction` rpc Relative to #14288 Tree-SHA512: baa791147e5ceb3c30c70df3981aaf807bf7d4a90a0be3625540b59aa4b9a9d303a452bfef18bf167cbb833ef9591b4ef5948bf4a1ce67b421d804ae8d20ea53
Diffstat (limited to 'src/test')
-rw-r--r--src/test/blockfilter_tests.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/blockfilter_tests.cpp b/src/test/blockfilter_tests.cpp
index 773de343ea..4941ebd483 100644
--- a/src/test/blockfilter_tests.cpp
+++ b/src/test/blockfilter_tests.cpp
@@ -114,7 +114,8 @@ BOOST_AUTO_TEST_CASE(blockfilters_json_test)
unsigned int pos = 0;
/*int block_height =*/ test[pos++].get_int();
- /*uint256 block_hash =*/ ParseHashStr(test[pos++].get_str(), "block_hash");
+ uint256 block_hash;
+ BOOST_CHECK(ParseHashStr(test[pos++].get_str(), block_hash));
CBlock block;
BOOST_REQUIRE(DecodeHexBlk(block, test[pos++].get_str()));
@@ -129,9 +130,11 @@ BOOST_AUTO_TEST_CASE(blockfilters_json_test)
tx_undo.vprevout.emplace_back(txout, 0, false);
}
- uint256 prev_filter_header_basic = ParseHashStr(test[pos++].get_str(), "prev_filter_header_basic");
+ uint256 prev_filter_header_basic;
+ BOOST_CHECK(ParseHashStr(test[pos++].get_str(), prev_filter_header_basic));
std::vector<unsigned char> filter_basic = ParseHex(test[pos++].get_str());
- uint256 filter_header_basic = ParseHashStr(test[pos++].get_str(), "filter_header_basic");
+ uint256 filter_header_basic;
+ BOOST_CHECK(ParseHashStr(test[pos++].get_str(), filter_header_basic));
BlockFilter computed_filter_basic(BlockFilterType::BASIC, block, block_undo);
BOOST_CHECK(computed_filter_basic.GetFilter().GetEncoded() == filter_basic);