aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <[email protected]>2020-06-24 14:24:03 -0400
committerMarcoFalke <[email protected]>2020-06-24 14:24:14 -0400
commit532b134cb0d0887a14fe79c2a2604498921caf6f (patch)
tree0aa7480acb3fa0162f49ab989bd40a8274acffe0 /src/test
parentMerge #19357: doc: add release note for bitcoin-cli -generate (diff)
parentrefactor: Replace HexStr(o.begin(), o.end()) with HexStr(o) (diff)
downloaddiscoin-532b134cb0d0887a14fe79c2a2604498921caf6f.tar.xz
discoin-532b134cb0d0887a14fe79c2a2604498921caf6f.zip
Merge #19373: refactor: Replace HexStr(o.begin(), o.end()) with HexStr(o)
bd93e32292c96b671e71223032ff8f660ce27c5d refactor: Replace HexStr(o.begin(), o.end()) with HexStr(o) (Wladimir J. van der Laan) Pull request description: HexStr can be called with anything that bas `begin()` and `end()` functions, so clean up the redundant calls. (context: I tried to convert `HexStr` to use span, but this turns out to be somewhat more involved than I thought, because of the limitation to pre-c++17 Span lacking iterator-based constructor) . This commit is a first step which stands on its own though) ACKs for top commit: jonatack: ACK bd93e32292c96b671e71223032ff8f660ce27c5d troygiorshev: ACK bd93e32292c96b671e71223032ff8f660ce27c5d MarcoFalke: review ACK bd93e32292c96b671e71223032ff8f660ce27c5d 🔌 Tree-SHA512: 7e4c9d0259b8d23271d233095f1c51db1ee021e865361d74c05c10dd5129aa6d34a243323e2b4596d648e2d7b25c7ebdee37a3e4f99a27883cb4c3cd26432b08
Diffstat (limited to 'src/test')
-rw-r--r--src/test/coins_tests.cpp2
-rw-r--r--src/test/descriptor_tests.cpp2
-rw-r--r--src/test/fuzz/decode_tx.cpp2
-rw-r--r--src/test/fuzz/key.cpp2
-rw-r--r--src/test/sighash_tests.cpp2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp
index 60196c36a..173ec5e3d 100644
--- a/src/test/coins_tests.cpp
+++ b/src/test/coins_tests.cpp
@@ -538,7 +538,7 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
CDataStream tmp(SER_DISK, CLIENT_VERSION);
uint64_t x = 3000000000ULL;
tmp << VARINT(x);
- BOOST_CHECK_EQUAL(HexStr(tmp.begin(), tmp.end()), "8a95c0bb00");
+ BOOST_CHECK_EQUAL(HexStr(tmp), "8a95c0bb00");
CDataStream ss5(ParseHex("00008a95c0bb00"), SER_DISK, CLIENT_VERSION);
try {
Coin cc5;
diff --git a/src/test/descriptor_tests.cpp b/src/test/descriptor_tests.cpp
index 5f9a78ceb..5d7065daf 100644
--- a/src/test/descriptor_tests.cpp
+++ b/src/test/descriptor_tests.cpp
@@ -216,7 +216,7 @@ void DoCheck(const std::string& prv, const std::string& pub, int flags, const st
// For each of the produced scripts, verify solvability, and when possible, try to sign a transaction spending it.
for (size_t n = 0; n < spks.size(); ++n) {
- BOOST_CHECK_EQUAL(ref[n], HexStr(spks[n].begin(), spks[n].end()));
+ BOOST_CHECK_EQUAL(ref[n], HexStr(spks[n]));
BOOST_CHECK_EQUAL(IsSolvable(Merge(key_provider, script_provider), spks[n]), (flags & UNSOLVABLE) == 0);
if (flags & SIGNABLE) {
diff --git a/src/test/fuzz/decode_tx.cpp b/src/test/fuzz/decode_tx.cpp
index 09c4ff05d..0d89d4228 100644
--- a/src/test/fuzz/decode_tx.cpp
+++ b/src/test/fuzz/decode_tx.cpp
@@ -14,7 +14,7 @@
void test_one_input(const std::vector<uint8_t>& buffer)
{
- const std::string tx_hex = HexStr(std::string{buffer.begin(), buffer.end()});
+ const std::string tx_hex = HexStr(buffer);
CMutableTransaction mtx;
const bool result_none = DecodeHexTx(mtx, tx_hex, false, false);
const bool result_try_witness = DecodeHexTx(mtx, tx_hex, false, true);
diff --git a/src/test/fuzz/key.cpp b/src/test/fuzz/key.cpp
index 1919a5f88..58735545c 100644
--- a/src/test/fuzz/key.cpp
+++ b/src/test/fuzz/key.cpp
@@ -108,7 +108,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
assert(pubkey.IsCompressed());
assert(pubkey.IsValid());
assert(pubkey.IsFullyValid());
- assert(HexToPubKey(HexStr(pubkey.begin(), pubkey.end())) == pubkey);
+ assert(HexToPubKey(HexStr(pubkey)) == pubkey);
assert(GetAllDestinationsForKey(pubkey).size() == 3);
}
diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp
index 5ca136ea6..c0bb92258 100644
--- a/src/test/sighash_tests.cpp
+++ b/src/test/sighash_tests.cpp
@@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE(sighash_test)
ss << txTo;
std::cout << "\t[\"" ;
- std::cout << HexStr(ss.begin(), ss.end()) << "\", \"";
+ std::cout << HexStr(ss) << "\", \"";
std::cout << HexStr(scriptCode) << "\", ";
std::cout << nIn << ", ";
std::cout << nHashType << ", \"";