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 ab48c5e721
Last updated 81e3228fcb
This commit is contained in:
Ben Woosley 2018-12-02 01:56:12 -08:00
parent ed12fd83ca
commit 75778a0724
No known key found for this signature in database
GPG key ID: 6EE5F3785F78B345
2 changed files with 4 additions and 10 deletions

View file

@ -64,12 +64,6 @@ public:
size_t size() const { return stream->size(); } size_t size() const { return stream->size(); }
}; };
template<typename S>
OverrideStream<S> WithOrVersion(S* s, int nVersionFlag)
{
return OverrideStream<S>(s, s->GetType(), s->GetVersion() | nVersionFlag);
}
/* Minimal stream for overwriting and/or appending to an existing byte vector /* Minimal stream for overwriting and/or appending to an existing byte vector
* *
* The referenced vector will grow as necessary * The referenced vector will grow as necessary

View file

@ -414,7 +414,8 @@ static void ReplaceRedeemScript(CScript& script, const CScript& redeemScript)
script = PushAll(stack); script = PushAll(stack);
} }
BOOST_AUTO_TEST_CASE(test_big_witness_transaction) { BOOST_AUTO_TEST_CASE(test_big_witness_transaction)
{
CMutableTransaction mtx; CMutableTransaction mtx;
mtx.nVersion = 1; mtx.nVersion = 1;
@ -456,9 +457,8 @@ BOOST_AUTO_TEST_CASE(test_big_witness_transaction) {
} }
CDataStream ssout(SER_NETWORK, PROTOCOL_VERSION); CDataStream ssout(SER_NETWORK, PROTOCOL_VERSION);
auto vstream = WithOrVersion(&ssout, 0); ssout << mtx;
vstream << mtx; CTransaction tx(deserialize, ssout);
CTransaction tx(deserialize, vstream);
// check all inputs concurrently, with the cache // check all inputs concurrently, with the cache
PrecomputedTransactionData txdata(tx); PrecomputedTransactionData txdata(tx);