numBlocksToUnlock is 0 if unused

This commit is contained in:
woodser
2019-07-10 17:38:07 -04:00
parent 2252b8fcf3
commit 7b23684eef
+1 -1
View File
@@ -2279,10 +2279,10 @@ namespace monero {
subaddress.balance = iter1 == balancePerSubaddress.end() ? 0 : iter1->second;
auto iter2 = unlockedBalancePerSubaddress.find(subaddressIdx);
subaddress.unlockedBalance = iter2 == unlockedBalancePerSubaddress.end() ? 0 : iter2->second.first;
subaddress.numBlocksToUnlock = iter2 == unlockedBalancePerSubaddress.end() ? 0 : iter2->second.second;
cryptonote::subaddress_index index = {accountIdx, subaddressIdx};
subaddress.numUnspentOutputs = count_if(transfers.begin(), transfers.end(), [&](const tools::wallet2::transfer_details& td) { return !td.m_spent && td.m_subaddr_index == index; });
subaddress.isUsed = find_if(transfers.begin(), transfers.end(), [&](const tools::wallet2::transfer_details& td) { return td.m_subaddr_index == index; }) != transfers.end();
subaddress.numBlocksToUnlock = subaddress.isUsed.get() ? iter2->second.second : 0;
subaddresses.push_back(subaddress);
}