Skip to content

Commit 615c7fe

Browse files
nahuhhj-berman
andauthored
jberman - src/wallet/wallet2.cpp
Co-authored-by: Justin Berman <[email protected]>
1 parent d143c3c commit 615c7fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/wallet/wallet2.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,17 +1960,18 @@ void wallet2::set_subaddress_lookahead(size_t major, size_t minor)
19601960
// Expand the subaddresses map so that outputs received to the higher lookaheads will be identified in the scan loop
19611961
hw::device &hwdev = m_account.get_device();
19621962
cryptonote::subaddress_index index2;
1963-
const uint32_t major_end = get_subaddress_clamped_sum(m_subaddress_labels.size(), major);
1963+
const uint32_t max_major_idx = this->get_num_subaddress_accounts() > 0 ? (this->get_num_subaddress_accounts() - 1) : 0;
1964+
const uint32_t major_end = get_subaddress_clamped_sum(max_major_idx, major);
19641965
for (index2.major = 0; index2.major < major_end; ++index2.major)
19651966
{
19661967
// The existing minor addresses already set for this account
19671968
const uint32_t n_minor_subaddrs = this->get_num_subaddresses(index2.major);
19681969

19691970
// The subaddress lookahead is expected to expand from the max index in expand_subaddresses
1970-
const uint32_t n_max_idx = n_minor_subaddrs > 0 ? (n_minor_subaddrs - 1) : 0;
1971-
const uint32_t begin = (n_minor_subaddrs || index2.major < old_major_lookahead) ? get_subaddress_clamped_sum(n_max_idx, old_minor_lookahead) : 0;
1971+
const uint32_t max_minor_idx = n_minor_subaddrs > 0 ? (n_minor_subaddrs - 1) : 0;
1972+
const uint32_t begin = (n_minor_subaddrs || index2.major < old_major_lookahead) ? get_subaddress_clamped_sum(max_minor_idx, old_minor_lookahead) : 0;
19721973
// The expected new n minor subaddresses allocated for this account
1973-
const uint32_t end = get_subaddress_clamped_sum(n_max_idx, minor);
1974+
const uint32_t end = get_subaddress_clamped_sum(max_minor_idx, minor);
19741975

19751976
if (begin >= end)
19761977
continue;

0 commit comments

Comments
 (0)