From 63e7d6ef2d6550cc512b7c11166fc4ca3550ce6d Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 28 Oct 2026 11:36:59 -0500 Subject: [PATCH] wallet: keep a throwing consolidation round's committed txs in its record The op tallied the round in a local and handed it over only through setConsolidationResult, which an exception thrown mid-round skips, so last_round and the cumulative totals lost transactions it had already committed. Tally into the member main() records from instead. Co-Authored-By: Claude Opus 5.5 --- src/wallet/asyncrpcoperation_saplingconsolidation.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp index 1ef89f9ce..82a81e7f0 100644 --- a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp +++ b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp @@ -212,7 +212,8 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { }; std::vector groups; std::vector txs; - ConsolidationTally tally; + // The member, not a local: if anything below throws, main() still records what was committed. + ConsolidationTally& tally = tally_; { LOCK2(cs_main, pwalletMain->cs_wallet); // We set minDepth to 11 to avoid unconfirmed notes and in anticipation of specifying @@ -429,7 +430,8 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { } void AsyncRPCOperation_saplingconsolidation::setConsolidationResult(const ConsolidationTally& tally) { - tally_ = tally; + if (&tally != &tally_) + tally_ = tally; UniValue res(UniValue::VOBJ); res.push_back(Pair("num_tx_created", (int)tally.txids.size())); res.push_back(Pair("amount_consolidated", FormatMoney(tally.amountConsolidated)));