From 3555a0bd853c3f7ee69025d6c468b79ddf634e41 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 23 May 2022 09:55:09 +0200 Subject: [PATCH] import gap limit from electrum wallets --- src/main/java/com/sparrowwallet/sparrow/io/Electrum.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java b/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java index 9cbe625c..d6c2ce8d 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java @@ -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 labels = new LinkedHashMap<>(); public Map transactions = new HashMap<>(); }