simplewallet: use the swept account for index=all in sweep_main

sweep_main() takes the account to sweep as a parameter, but the index=all
expansion still counts subaddresses on m_current_subaddress_account. sweep_all
and sweep_below pass the current account, so sweep_account is the one command
that ends up with the wrong set.

When the current account has fewer subaddresses than the account being swept,
the set is too small and outputs in the higher minor indices never make it into
the sweep. If none of the target's unlocked outputs land in that range,
create_transactions_all throws "No unlocked balance in the specified
subaddress(es)" for an account that plainly has a balance.

27d551d12f added the account parameter and pointed create_transactions_all at
it, but left this loop on the old field. The RPC path already does it the right
way, with get_num_subaddresses(req.account_index).
This commit is contained in:
Cole Munz
2026-07-31 23:43:43 -05:00
parent ae3931c1d9
commit e26eab8ca7
+1 -1
View File
@@ -6849,7 +6849,7 @@ bool simple_wallet::sweep_main(uint32_t account, uint64_t below, const std::vect
{
if (local_args[0] == "index=all")
{
for (uint32_t i = 0; i < m_wallet->get_num_subaddresses(m_current_subaddress_account); ++i)
for (uint32_t i = 0; i < m_wallet->get_num_subaddresses(account); ++i)
subaddr_indices.insert(i);
}
else if (!parse_subaddress_indices(local_args[0], subaddr_indices))