Fix tests that assume CTxOuts can be "null"
This commit is contained in:
parent
29ec54fad6
commit
08baaaa492
|
@ -1,3 +1,10 @@
|
|||
# "Coins" view
|
||||
|
||||
TBD
|
||||
|
||||
## Notes
|
||||
|
||||
- This is the main context in which `CTxOut::IsNull()` is used. The other is a
|
||||
single spot in the mempool code. Once we've backported the
|
||||
[per-txout CoinsDB](https://github.com/bitcoin/bitcoin/pull/10195) we can
|
||||
hopefully eliminate this method.
|
||||
|
|
|
@ -65,6 +65,10 @@ BOOST_DATA_TEST_CASE(multisig_verify, boost::unit_test::data::xrange(static_cast
|
|||
txFrom.vout[0].scriptPubKey = a_and_b;
|
||||
txFrom.vout[1].scriptPubKey = a_or_b;
|
||||
txFrom.vout[2].scriptPubKey = escrow;
|
||||
// Meaningless values, but we need them for the Rust code to parse this.
|
||||
txFrom.vout[0].nValue = 10;
|
||||
txFrom.vout[1].nValue = 10;
|
||||
txFrom.vout[2].nValue = 10;
|
||||
|
||||
CMutableTransaction txTo[3]; // Spending transaction
|
||||
for (int i = 0; i < 3; i++)
|
||||
|
@ -205,6 +209,10 @@ BOOST_DATA_TEST_CASE(multisig_Sign, boost::unit_test::data::xrange(static_cast<i
|
|||
txFrom.vout[0].scriptPubKey = a_and_b;
|
||||
txFrom.vout[1].scriptPubKey = a_or_b;
|
||||
txFrom.vout[2].scriptPubKey = escrow;
|
||||
// Meaningless values, but we need them for the Rust code to parse this.
|
||||
txFrom.vout[0].nValue = 10;
|
||||
txFrom.vout[1].nValue = 10;
|
||||
txFrom.vout[2].nValue = 10;
|
||||
|
||||
CMutableTransaction txTo[3]; // Spending transaction
|
||||
for (int i = 0; i < 3; i++)
|
||||
|
|
|
@ -36,6 +36,8 @@ Verify(const CScript& scriptSig, const CScript& scriptPubKey, bool fStrict, Scri
|
|||
CMutableTransaction txFrom;
|
||||
txFrom.vout.resize(1);
|
||||
txFrom.vout[0].scriptPubKey = scriptPubKey;
|
||||
// Meaningless value, but we need it for the Rust code to parse this.
|
||||
txFrom.vout[0].nValue = 10;
|
||||
|
||||
CMutableTransaction txTo;
|
||||
txTo.vin.resize(1);
|
||||
|
@ -336,6 +338,8 @@ BOOST_DATA_TEST_CASE(AreInputsStandard, boost::unit_test::data::xrange(static_ca
|
|||
CMutableTransaction txTo;
|
||||
txTo.vout.resize(1);
|
||||
txTo.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID());
|
||||
// Meaningless value, but we need it for the Rust code to parse this.
|
||||
txTo.vout[0].nValue = 10;
|
||||
|
||||
txTo.vin.resize(5);
|
||||
for (int i = 0; i < 5; i++)
|
||||
|
|
|
@ -595,6 +595,8 @@ BOOST_DATA_TEST_CASE(test_Get, boost::unit_test::data::xrange(static_cast<int>(C
|
|||
t1.vout.resize(2);
|
||||
t1.vout[0].nValue = 90*CENT;
|
||||
t1.vout[0].scriptPubKey << OP_1;
|
||||
// Meaningless value, but we need it for the Rust code to parse this.
|
||||
t1.vout[1].nValue = CENT;
|
||||
|
||||
BOOST_CHECK(AreInputsStandard(t1, coins, consensusBranchId));
|
||||
BOOST_CHECK_EQUAL(coins.GetValueIn(t1), (50+21+22)*CENT);
|
||||
|
@ -765,11 +767,14 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
|
|||
|
||||
// TX_NULL_DATA w/o PUSHDATA
|
||||
t.vout.resize(1);
|
||||
t.vout[0].nValue = 0; // Needed for Rust parser
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN;
|
||||
BOOST_CHECK(IsStandardTx(t, reason, chainparams));
|
||||
|
||||
// Only one TX_NULL_DATA permitted in all cases
|
||||
t.vout.resize(2);
|
||||
t.vout[0].nValue = 0; // Needed for Rust parser
|
||||
t.vout[1].nValue = 0; // Needed for Rust parser
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
|
||||
t.vout[1].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
|
||||
BOOST_CHECK(!IsStandardTx(t, reason, chainparams));
|
||||
|
|
|
@ -1665,6 +1665,7 @@ TEST(WalletTests, SetBestChainIgnoresTxsWithoutShieldedData) {
|
|||
auto wtxTmp = GetValidSproutSpend(sk2, note, 5);
|
||||
CMutableTransaction mtx {wtxTmp};
|
||||
mtx.vout[0].scriptPubKey = scriptPubKey;
|
||||
mtx.vout[0].nValue = CENT;
|
||||
CWalletTx wtxSproutTransparent {nullptr, mtx};
|
||||
wallet.AddToWallet(wtxSproutTransparent, true, nullptr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue