wallet: end a consolidation round early on shutdown or a queued op
A stop issued during a consolidation round waited for the whole round to be built and committed: 634 s in review, ~8 min for the default 18 txs on a crowded wallet. StopRPC cancels every queued operation, but AsyncRPCOperation::cancel() is not virtual, so the op's own cancel(), which moves an EXECUTING op to CANCELLED, is never called and its isCancelled() checks between transactions never fire. A GUI that kills dragonxd 20 s into shutdown then kills it mid-round, which costs a chainstate replay and a witness rebuild on the next start. Check ShutdownRequested() next to isCancelled() before building each transaction and before committing it, so a stop waits for one tx at most. Making cancel() virtual would also do it, but would change what the sweep and autoshield schedulers' cancel of their previous op does. dragonxd also has a single async worker, so a z_sendmany made during a round waited for all of it. After each committed tx the round now ends when another operation is queued. Its unspent planned notes are unlocked as before and the next round takes them up. last_round and the op result report it as yielded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3333,6 +3333,8 @@ UniValue z_consolidationstatus(const UniValue& params, bool fHelp, const CPubKey
|
||||
" \"amount_consolidated\" : n, (numeric) value of the notes created, in puposhis\n"
|
||||
" \"fees\" : n, (numeric) in puposhis\n"
|
||||
" \"skipped_notes\" : n, (numeric) notes left out for a missing or unusable witness\n"
|
||||
" \"yielded\" : true|false, (boolean) it stopped after a transaction to let a queued operation\n"
|
||||
" (z_sendmany, ...) run; the next round goes on\n"
|
||||
" \"error\" : \"...\" (string) why it stopped early; empty if it did not\n"
|
||||
" },\n"
|
||||
" \"disabled_reason\" : \"...\", (string) why no periodic round can start now; empty if one can\n"
|
||||
@@ -3388,6 +3390,7 @@ UniValue z_consolidationstatus(const UniValue& params, bool fHelp, const CPubKey
|
||||
last.push_back(Pair("amount_consolidated", (int64_t)r.amountConsolidated));
|
||||
last.push_back(Pair("fees", (int64_t)r.fees));
|
||||
last.push_back(Pair("skipped_notes", r.skippedNotes));
|
||||
last.push_back(Pair("yielded", r.yielded));
|
||||
last.push_back(Pair("error", r.error));
|
||||
ret.push_back(Pair("last_round", last));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user