diff options
author | glozow <gloriajzhao@gmail.com> | 2022-12-05 14:32:35 +0000 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2023-01-06 17:37:01 +0000 |
commit | 5d35b4a7dee95ae70bfdcbe79bc39fe488641b23 (patch) | |
tree | 7ca319ef2f2889fa4ca10315f25f9bf1b4ea9fae /src | |
parent | be2e4d94e59510e0a98408313feb27e97321b16e (diff) |
[test] package validation quits early due to non-policy, non-missing-inputs failure
Diffstat (limited to 'src')
-rw-r--r-- | src/test/txpackage_tests.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/txpackage_tests.cpp b/src/test/txpackage_tests.cpp index b290a664f9..e77fcecf37 100644 --- a/src/test/txpackage_tests.cpp +++ b/src/test/txpackage_tests.cpp @@ -278,6 +278,24 @@ BOOST_FIXTURE_TEST_CASE(package_submission_tests, TestChain100Setup) BOOST_CHECK(result_3gen_submit.m_package_feerate == std::nullopt); } + // Parent and child package where transactions are invalid for reasons other than fee and + // missing inputs, so the package validation isn't expected to happen. + { + CScriptWitness bad_witness; + bad_witness.stack.push_back(std::vector<unsigned char>(1)); + CMutableTransaction mtx_parent_invalid{mtx_parent}; + mtx_parent_invalid.vin[0].scriptWitness = bad_witness; + CTransactionRef tx_parent_invalid = MakeTransactionRef(mtx_parent_invalid); + auto result_quit_early = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, + {tx_parent_invalid, tx_child}, /*test_accept=*/ false); + BOOST_CHECK(result_quit_early.m_state.IsInvalid()); + BOOST_CHECK_EQUAL(result_quit_early.m_state.GetResult(), PackageValidationResult::PCKG_TX); + BOOST_CHECK(!result_quit_early.m_tx_results.empty()); + auto it_parent = result_quit_early.m_tx_results.find(tx_parent_invalid->GetWitnessHash()); + BOOST_CHECK(it_parent != result_quit_early.m_tx_results.end()); + BOOST_CHECK_EQUAL(it_parent->second.m_state.GetResult(), TxValidationResult::TX_WITNESS_MUTATED); + } + // Child with missing parent. mtx_child.vin.push_back(CTxIn(COutPoint(package_unrelated[0]->GetHash(), 0))); Package package_missing_parent; |