fix concurrent modification exception

This commit is contained in:
pokkst 2022-09-17 17:53:32 -05:00
parent 52676d2184
commit d6d5e82bec
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF

View File

@ -5,6 +5,10 @@ import net.mynero.wallet.model.TransactionInfo;
import net.mynero.wallet.model.Wallet;
import net.mynero.wallet.model.WalletManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class AddressService extends ServiceBase {
public static AddressService instance = null;
private int latestAddressIndex = 1;
@ -19,7 +23,8 @@ public class AddressService extends ServiceBase {
}
public void refreshAddresses() {
for (TransactionInfo info : HistoryService.getInstance().getHistory()) {
List<TransactionInfo> localTransactionList = new ArrayList<>(HistoryService.getInstance().getHistory());
for (TransactionInfo info : localTransactionList) {
if (info.addressIndex >= latestAddressIndex) {
latestAddressIndex = info.addressIndex + 1;
}