Also lock transparent input utxos in z_sendmany, like z_mergetoaddress already does

This commit is contained in:
Duke
2025-05-19 08:56:53 -04:00
parent 532b15b45e
commit 2bd3b510ed

View File

@@ -121,7 +121,7 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
}
// Lock UTXOs
//lock_utxos();
lock_utxos();
// Lock shielded input notes
lock_notes();
LogPrint("zrpc", "%s: z_sendmany input notes locked\n", getId());
@@ -192,7 +192,7 @@ void AsyncRPCOperation_sendmany::main() {
}
LogPrintf("%s",s);
//unlock_utxos(); // clean up
unlock_utxos(); // clean up
unlock_notes(); // clean up
LogPrint("zrpc", "%s: z_sendmany input notes unlocked\n", getId());
}
@@ -792,13 +792,14 @@ UniValue AsyncRPCOperation_sendmany::getStatus() const {
return obj;
}
/* TODO: support locking taddr utxo inputs
// Lock input utxos
void AsyncRPCOperation_sendmany::lock_utxos() {
LOCK2(cs_main, pwalletMain->cs_wallet);
for (auto utxo : t_inputs_) {
COutPoint outpt(utxo.txid, utxo.vout);
uint256 txid = std::get<0>(utxo);
int vout = std::get<1>(utxo);
COutPoint outpt(txid, vout);
pwalletMain->LockCoin(outpt);
}
}
@@ -807,13 +808,14 @@ UniValue AsyncRPCOperation_sendmany::getStatus() const {
void AsyncRPCOperation_sendmany::unlock_utxos() {
LOCK2(cs_main, pwalletMain->cs_wallet);
for (auto utxo : t_inputs_) {
COutPoint outpt(utxo.txid, utxo.vout);
uint256 txid = std::get<0>(utxo);
int vout = std::get<1>(utxo);
COutPoint outpt(txid, vout);
pwalletMain->UnlockCoin(outpt);
}
}
*/
// Lock input notes
void AsyncRPCOperation_sendmany::lock_notes() {
LOCK2(cs_main, pwalletMain->cs_wallet);