From db740fa037bda078160bac7a06545b08e7c05a4d Mon Sep 17 00:00:00 2001 From: akildemir Date: Mon, 24 Feb 2025 13:30:31 +0300 Subject: [PATCH] make a separate tx per subaddress --- src/wallet/api/wallet.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 31b3316b7..976c94e18 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1568,9 +1568,30 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transact adjusted_priority, extra, subaddr_account, subaddr_indices); } else { - transaction->m_pending_tx = m_wallet->create_transactions_all(0, converted_tx_type, "SAL", info.address, info.is_subaddress, 1, fake_outs_count, 0 /* unlock_time */, - adjusted_priority, - extra, subaddr_account, subaddr_indices); + std::vector m_pending_txs; + for (auto it = subaddr_indices.begin(); it != subaddr_indices.end(); ++it) { + + // Skip this wallet if there is no balance unlocked to audit + const auto unlocked_balance_per_subaddr = m_wallet->unlocked_balance_per_subaddress(subaddr_account, "SAL", true); + if (unlocked_balance_per_subaddr.count(*it) == 0) continue; + + const auto result = m_wallet->create_transactions_all( + 0, + converted_tx_type, + "SAL", + m_wallet->get_subaddress({subaddr_account, *it}), + info.is_subaddress, + 1, + fake_outs_count, + 0 /* unlock_time */, + adjusted_priority, + extra, + subaddr_account, + std::set {*it} + ); + m_pending_txs.insert(m_pending_txs.end(), result.begin(), result.end()); + } + transaction->m_pending_tx = m_pending_txs; } pendingTxPostProcess(transaction);