@@ -257,15 +257,6 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
257257
258258 const auto result_package = WITH_LOCK (::cs_main,
259259 return ProcessNewPackage (chainstate, tx_pool, txs, /* test_accept=*/ single_submit));
260- // If something went wrong due to a package-specific policy, it might not return a
261- // validation result for the transaction.
262- if (result_package.m_state .GetResult () != PackageValidationResult::PCKG_POLICY) {
263- auto it = result_package.m_tx_results .find (txs.back ()->GetWitnessHash ());
264- Assert (it != result_package.m_tx_results .end ());
265- Assert (it->second .m_result_type == MempoolAcceptResult::ResultType::VALID ||
266- it->second .m_result_type == MempoolAcceptResult::ResultType::INVALID ||
267- it->second .m_result_type == MempoolAcceptResult::ResultType::MEMPOOL_ENTRY);
268- }
269260
270261 const auto res = WITH_LOCK (::cs_main, return AcceptToMemoryPool (chainstate, txs.back (), GetTime (), bypass_limits, /* test_accept=*/ !single_submit));
271262 const bool accepted = res.m_result_type == MempoolAcceptResult::ResultType::VALID;
@@ -281,6 +272,12 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
281272 Assert (added.size () == 1 );
282273 Assert (txs.back () == *added.begin ());
283274 }
275+ } else if (result_package.m_state .GetResult () != PackageValidationResult::PCKG_POLICY) {
276+ // We don't know anything about the validity since transactions were randomly generated, so
277+ // just use result_package.m_state here. This makes the expect_valid check meaningless, but
278+ // we can still verify that the contents of m_tx_results are consistent with m_state.
279+ const bool expect_valid{result_package.m_state .IsValid ()};
280+ Assert (!CheckPackageMempoolAcceptResult (txs, result_package, expect_valid, nullptr ));
284281 } else {
285282 // This is empty if it fails early checks, or "full" if transactions are looked at deeper
286283 Assert (result_package.m_tx_results .size () == txs.size () || result_package.m_tx_results .empty ());
0 commit comments