import gap limit from electrum wallets

This commit is contained in:
Craig Raw 2022-05-23 09:55:09 +02:00
parent d7ce58d810
commit 3555a0bd85

View file

@ -95,6 +95,10 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport
}
}
if(key.equals("gap_limit") && map.get(key) instanceof JsonPrimitive gapLimit) {
ew.gap_limit = gapLimit.getAsInt();
}
if(key.equals("addresses")) {
ew.addresses = gson.fromJson(map.get(key), ElectrumAddresses.class);
}
@ -209,6 +213,10 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport
throw new ImportException("Unknown Electrum wallet type of " + ew.wallet_type);
}
if(ew.gap_limit != null) {
wallet.setGapLimit(ew.gap_limit);
}
for(String key : ew.labels.keySet()) {
try {
Sha256Hash txHash = Sha256Hash.wrap(key);
@ -408,6 +416,7 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport
public String seed_type;
public Boolean use_encryption;
public ElectrumAddresses addresses;
public Integer gap_limit;
public Map<String, String> labels = new LinkedHashMap<>();
public Map<Sha256Hash, BlockTransaction> transactions = new HashMap<>();
}