From 59efe29a78135049a00b0fd735725df7acf9b20f Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 13 Jun 2021 00:11:29 +0100 Subject: [PATCH] test: Small fixes to sighash test vector generation Also tweaks the test that parses them to display errors --- src/test/sighash_tests.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 9774d4a93..050832512 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -117,7 +117,7 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle, uint32_t co tx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID; tx.nVersion = overwinter_version_dist(rng); } - tx.nExpiryHeight = (insecure_rand() % 2) ? insecure_rand() : 0; + tx.nExpiryHeight = (insecure_rand() % 2) ? insecure_rand() % TX_EXPIRY_HEIGHT_THRESHOLD : 0; } else { tx.nVersion = insecure_rand() & 0x7FFFFFFF; } @@ -229,7 +229,8 @@ BOOST_AUTO_TEST_CASE(sighash_test) #endif for (int i=0; i raw = ParseHex(raw_script); scriptCode.insert(scriptCode.end(), raw.begin(), raw.end()); + } catch (const std::exception& ex) { + BOOST_ERROR("Bad test, couldn't deserialize data: " << strTest << ": " << ex.what()); + continue; } catch (...) { BOOST_ERROR("Bad test, couldn't deserialize data: " << strTest); continue;