Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 343c090

Browse files
committed
Make CWallet::AbandonTransaction print error instead of assert false for spends in mempool
1 parent 7d6f351 commit 343c090

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/wallet/wallet.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,13 @@ bool CWallet::AbandonTransaction(const uint256& hashTx, std::string* pstrReason)
12711271
// if (currentconfirm < 0) {Tx and spends are already conflicted, no need to abandon}
12721272
if (currentconfirm == 0 && !wtx.isAbandoned()) {
12731273
// If the orig tx was not in block/mempool, none of its spends can be in mempool
1274-
assert(!wtx.InMempool());
1274+
if (wtx.InMempool()) {
1275+
if (pstrReason)
1276+
*pstrReason = "Spends in mempool!";
1277+
1278+
return false;
1279+
}
1280+
12751281
wtx.nIndex = -1;
12761282
wtx.setAbandoned();
12771283
wtx.MarkDirty();

0 commit comments

Comments
 (0)