diff options
author | Greg Sanders <gsanders87@gmail.com> | 2023-11-03 16:04:54 -0400 |
---|---|---|
committer | Greg Sanders <gsanders87@gmail.com> | 2023-11-03 16:05:55 -0400 |
commit | 5380f055136ea99f76cd3df2c2add081852d35d0 (patch) | |
tree | ec1b93d364bacbdc28a3c94ea91a515ed4705141 /src/test/util | |
parent | d9007f51a7480246abe4c16f2e3d190988470bec (diff) |
test: bugfix CheckPackageMempoolAcceptResult return all error strings
Diffstat (limited to 'src/test/util')
-rw-r--r-- | src/test/util/txmempool.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/util/txmempool.cpp b/src/test/util/txmempool.cpp index c4fbc8dbb3..147e589deb 100644 --- a/src/test/util/txmempool.cpp +++ b/src/test/util/txmempool.cpp @@ -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()); } } } |