0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-03 09:56:38 -05:00

Merge bitcoin/bitcoin#28788: test: bugfix CheckPackageMempoolAcceptResult return all error strings

5380f05513 test: bugfix CheckPackageMempoolAcceptResult return all error strings (Greg Sanders)

Pull request description:

  Noticed on follow-up testing work https://github.com/bitcoin/bitcoin/pull/28764/files#r1382150706

ACKs for top commit:
  glozow:
    utACK 5380f05513
  dergoegge:
    utACK 5380f05513

Tree-SHA512: abe122b5d702aaa0d731b45f6ba0f2f8ff9ecc14398cc087df56ee0980b5b483fc159d38ec36fe6360f82e5443673cfa80afc1c9cee6b840c95703b7dc8a8d3f
This commit is contained in:
fanquake 2023-11-06 14:25:36 +00:00
commit 21d985784f
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -49,11 +49,11 @@ std::optional<std::string> CheckPackageMempoolAcceptResult(const Package& txns,
}
} else {
if (result.m_state.IsValid()) {
strprintf("Package validation unexpectedly succeeded. %s", result.m_state.ToString());
return strprintf("Package validation unexpectedly succeeded. %s", result.m_state.ToString());
}
}
if (result.m_state.GetResult() != PackageValidationResult::PCKG_POLICY && txns.size() != result.m_tx_results.size()) {
strprintf("txns size %u does not match tx results size %u", txns.size(), result.m_tx_results.size());
return strprintf("txns size %u does not match tx results size %u", txns.size(), result.m_tx_results.size());
}
for (const auto& tx : txns) {
const auto& wtxid = tx->GetWitnessHash();
@ -102,12 +102,12 @@ std::optional<std::string> CheckPackageMempoolAcceptResult(const Package& txns,
// The tx by txid should be in the mempool iff the result was not INVALID.
const bool txid_in_mempool{atmp_result.m_result_type != MempoolAcceptResult::ResultType::INVALID};
if (mempool->exists(GenTxid::Txid(tx->GetHash())) != txid_in_mempool) {
strprintf("tx %s should %sbe in mempool", wtxid.ToString(), txid_in_mempool ? "" : "not ");
return strprintf("tx %s should %sbe in mempool", wtxid.ToString(), txid_in_mempool ? "" : "not ");
}
// Additionally, if the result was DIFFERENT_WITNESS, we shouldn't be able to find the tx in mempool by wtxid.
if (tx->HasWitness() && atmp_result.m_result_type == MempoolAcceptResult::ResultType::DIFFERENT_WITNESS) {
if (mempool->exists(GenTxid::Wtxid(wtxid))) {
strprintf("wtxid %s should not be in mempool", wtxid.ToString());
return strprintf("wtxid %s should not be in mempool", wtxid.ToString());
}
}
}