diff --git a/src/wallet/asyncrpcoperation_autoshieldcoinbase.cpp b/src/wallet/asyncrpcoperation_autoshieldcoinbase.cpp index 72cf166b6..9628269ed 100644 --- a/src/wallet/asyncrpcoperation_autoshieldcoinbase.cpp +++ b/src/wallet/asyncrpcoperation_autoshieldcoinbase.cpp @@ -461,6 +461,9 @@ bool AsyncRPCOperation_autoshieldcoinbase::main_impl() { } LogPrintf("%s: autoshield tx FAILED in CommitTransaction, txid=%s\n", opid, tx.GetHash().ToString()); + set_error_code(RPC_WALLET_ERROR); + set_error_message(strprintf("Autoshield transaction %s was not accepted into the mempool (see debug.log for the " + "reason). The next round tries again.", tx.GetHash().ToString())); return false; } diff --git a/src/wallet/asyncrpcoperation_sweep.cpp b/src/wallet/asyncrpcoperation_sweep.cpp index fcc4ccad1..e86f3d457 100644 --- a/src/wallet/asyncrpcoperation_sweep.cpp +++ b/src/wallet/asyncrpcoperation_sweep.cpp @@ -411,6 +411,12 @@ bool AsyncRPCOperation_sweep::main_impl() { numTxCreated++; } else { LogPrintf("%s: Sweep transaction FAILED in CommitTransaction, txid=%s\n",opid , tx.GetHash().ToString()); + // Say why the round failed: this used to finish as "failed" with an empty error. The mempool's + // reason is in debug.log just above (most often a note already spent by another transaction). + set_error_code(RPC_WALLET_ERROR); + set_error_message(strprintf("Sweep transaction %s was not accepted into the mempool (see debug.log for " + "the reason; usually one of its notes was spent by another transaction " + "meanwhile). The next round sweeps what is left.", tx.GetHash().ToString())); setSweepResult(numTxCreated, amountSwept, sweepTxIds); status = false; break;