diff --git a/doc/book/src/design/coins-view.md b/doc/book/src/design/coins-view.md index 0d61ccebc..79a44fdf2 100644 --- a/doc/book/src/design/coins-view.md +++ b/doc/book/src/design/coins-view.md @@ -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. diff --git a/src/test/multisig_tests.cpp b/src/test/multisig_tests.cpp index e45783e61..2aabbb3d2 100644 --- a/src/test/multisig_tests.cpp +++ b/src/test/multisig_tests.cpp @@ -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(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)); diff --git a/src/wallet/gtest/test_wallet.cpp b/src/wallet/gtest/test_wallet.cpp index 3a2659ab7..cc367da37 100644 --- a/src/wallet/gtest/test_wallet.cpp +++ b/src/wallet/gtest/test_wallet.cpp @@ -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);