Skip to content

Commit 75778a0

Browse files
committed
test: Correct ineffectual WithOrVersion from transactions_tests
WithOrVersion uses | to combine the versions, and | with 0 is a no-op. Instead I run it with PROTOCOL_VERSION and 0 separately, as the original code only tested PROTOCOL_VERSION but apparently only intended to test version 0. Introduced in ab48c5e Last updated 81e3228
1 parent ed12fd8 commit 75778a0

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/streams.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ class OverrideStream
6464
size_t size() const { return stream->size(); }
6565
};
6666

67-
template<typename S>
68-
OverrideStream<S> WithOrVersion(S* s, int nVersionFlag)
69-
{
70-
return OverrideStream<S>(s, s->GetType(), s->GetVersion() | nVersionFlag);
71-
}
72-
7367
/* Minimal stream for overwriting and/or appending to an existing byte vector
7468
*
7569
* The referenced vector will grow as necessary

src/test/transaction_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ static void ReplaceRedeemScript(CScript& script, const CScript& redeemScript)
414414
script = PushAll(stack);
415415
}
416416

417-
BOOST_AUTO_TEST_CASE(test_big_witness_transaction) {
417+
BOOST_AUTO_TEST_CASE(test_big_witness_transaction)
418+
{
418419
CMutableTransaction mtx;
419420
mtx.nVersion = 1;
420421

@@ -456,9 +457,8 @@ BOOST_AUTO_TEST_CASE(test_big_witness_transaction) {
456457
}
457458

458459
CDataStream ssout(SER_NETWORK, PROTOCOL_VERSION);
459-
auto vstream = WithOrVersion(&ssout, 0);
460-
vstream << mtx;
461-
CTransaction tx(deserialize, vstream);
460+
ssout << mtx;
461+
CTransaction tx(deserialize, ssout);
462462

463463
// check all inputs concurrently, with the cache
464464
PrecomputedTransactionData txdata(tx);

0 commit comments

Comments
 (0)