From 88143a87fc659851ca191709b2e5fb68bb9888dc Mon Sep 17 00:00:00 2001 From: Duke Date: Fri, 30 May 2025 08:22:31 -0400 Subject: [PATCH] Clean up locks if z_sendmany is cancelled --- src/wallet/asyncrpcoperation_sendmany.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index b796b101f..a78fefb51 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -131,8 +131,13 @@ AsyncRPCOperation_sendmany::~AsyncRPCOperation_sendmany() { } void AsyncRPCOperation_sendmany::main() { - if (isCancelled()) + + // clean up locks if we are cancelled + if (isCancelled()) { + unlock_utxos(); + unlock_notes(); return; + } set_state(OperationStatus::EXECUTING); start_execution_clock(); @@ -797,6 +802,7 @@ void AsyncRPCOperation_sendmany::unlock_utxos() { // Lock input notes void AsyncRPCOperation_sendmany::lock_notes() { LOCK2(cs_main, pwalletMain->cs_wallet); + fprintf(stderr,"%s: found %d notes to lock\n", z_sapling_inputs_.count() ); for (auto note : z_sapling_inputs_) { pwalletMain->LockNote(note.op); } @@ -805,6 +811,7 @@ void AsyncRPCOperation_sendmany::lock_notes() { // Unlock input notes void AsyncRPCOperation_sendmany::unlock_notes() { LOCK2(cs_main, pwalletMain->cs_wallet); + fprintf(stderr,"%s: found %d notes to unlock\n", z_sapling_inputs_.count() ); for (auto note : z_sapling_inputs_) { pwalletMain->UnlockNote(note.op); }