Skip to content

Commit 21d9857

Browse files
committed
Merge bitcoin/bitcoin#28788: test: bugfix CheckPackageMempoolAcceptResult return all error strings
5380f05 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 5380f05 dergoegge: utACK 5380f05 Tree-SHA512: abe122b5d702aaa0d731b45f6ba0f2f8ff9ecc14398cc087df56ee0980b5b483fc159d38ec36fe6360f82e5443673cfa80afc1c9cee6b840c95703b7dc8a8d3f
2 parents f2cc718 + 5380f05 commit 21d9857

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/util/txmempool.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ std::optional<std::string> CheckPackageMempoolAcceptResult(const Package& txns,
4949
}
5050
} else {
5151
if (result.m_state.IsValid()) {
52-
strprintf("Package validation unexpectedly succeeded. %s", result.m_state.ToString());
52+
return strprintf("Package validation unexpectedly succeeded. %s", result.m_state.ToString());
5353
}
5454
}
5555
if (result.m_state.GetResult() != PackageValidationResult::PCKG_POLICY && txns.size() != result.m_tx_results.size()) {
56-
strprintf("txns size %u does not match tx results size %u", txns.size(), result.m_tx_results.size());
56+
return strprintf("txns size %u does not match tx results size %u", txns.size(), result.m_tx_results.size());
5757
}
5858
for (const auto& tx : txns) {
5959
const auto& wtxid = tx->GetWitnessHash();
@@ -102,12 +102,12 @@ std::optional<std::string> CheckPackageMempoolAcceptResult(const Package& txns,
102102
// The tx by txid should be in the mempool iff the result was not INVALID.
103103
const bool txid_in_mempool{atmp_result.m_result_type != MempoolAcceptResult::ResultType::INVALID};
104104
if (mempool->exists(GenTxid::Txid(tx->GetHash())) != txid_in_mempool) {
105-
strprintf("tx %s should %sbe in mempool", wtxid.ToString(), txid_in_mempool ? "" : "not ");
105+
return strprintf("tx %s should %sbe in mempool", wtxid.ToString(), txid_in_mempool ? "" : "not ");
106106
}
107107
// Additionally, if the result was DIFFERENT_WITNESS, we shouldn't be able to find the tx in mempool by wtxid.
108108
if (tx->HasWitness() && atmp_result.m_result_type == MempoolAcceptResult::ResultType::DIFFERENT_WITNESS) {
109109
if (mempool->exists(GenTxid::Wtxid(wtxid))) {
110-
strprintf("wtxid %s should not be in mempool", wtxid.ToString());
110+
return strprintf("wtxid %s should not be in mempool", wtxid.ToString());
111111
}
112112
}
113113
}

0 commit comments

Comments
 (0)