Clean up locks if z_sendmany is cancelled
This commit is contained in:
@@ -131,8 +131,13 @@ AsyncRPCOperation_sendmany::~AsyncRPCOperation_sendmany() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AsyncRPCOperation_sendmany::main() {
|
void AsyncRPCOperation_sendmany::main() {
|
||||||
if (isCancelled())
|
|
||||||
|
// clean up locks if we are cancelled
|
||||||
|
if (isCancelled()) {
|
||||||
|
unlock_utxos();
|
||||||
|
unlock_notes();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
set_state(OperationStatus::EXECUTING);
|
set_state(OperationStatus::EXECUTING);
|
||||||
start_execution_clock();
|
start_execution_clock();
|
||||||
@@ -797,6 +802,7 @@ void AsyncRPCOperation_sendmany::unlock_utxos() {
|
|||||||
// Lock input notes
|
// Lock input notes
|
||||||
void AsyncRPCOperation_sendmany::lock_notes() {
|
void AsyncRPCOperation_sendmany::lock_notes() {
|
||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
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_) {
|
for (auto note : z_sapling_inputs_) {
|
||||||
pwalletMain->LockNote(note.op);
|
pwalletMain->LockNote(note.op);
|
||||||
}
|
}
|
||||||
@@ -805,6 +811,7 @@ void AsyncRPCOperation_sendmany::lock_notes() {
|
|||||||
// Unlock input notes
|
// Unlock input notes
|
||||||
void AsyncRPCOperation_sendmany::unlock_notes() {
|
void AsyncRPCOperation_sendmany::unlock_notes() {
|
||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
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_) {
|
for (auto note : z_sapling_inputs_) {
|
||||||
pwalletMain->UnlockNote(note.op);
|
pwalletMain->UnlockNote(note.op);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user