wallet: say why a zsweep or autoshield round failed when its tx is rejected
When CommitAutomatedTx refused a transaction (AcceptToMemoryPool rejected it),
the sweep and autoshield ops returned false without setting an error, so the
operation finished as "failed" with an empty message:
Sweep operation finished. (status=failed, error=)
Seen twice in 175 sweep rounds in the 2026-12-01 soak; one was a note already
spent by another transaction ("sapling nullifier ... exists"). Both ops now set
RPC_WALLET_ERROR and a message naming the rejected txid, pointing at debug.log
for the mempool's reason (CommitTransaction does not return it), and saying the
next round retries. Consolidation already records a per-address reason.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user