From a9a3eef157a6a2b160486105ca0d0823c7459a1e Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 18 Jan 2021 13:39:12 +0200 Subject: [PATCH] truncate long electrum wallet labels --- src/main/java/com/sparrowwallet/sparrow/io/Electrum.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java b/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java index 618197a0..bd18c0e0 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java @@ -173,6 +173,10 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport keystore.setKeyDerivation(new KeyDerivation(masterFingerprint, derivationPath)); keystore.setExtendedPublicKey(xPub); keystore.setLabel(ek.label != null ? ek.label : "Electrum"); + if(keystore.getLabel().length() > Keystore.MAX_LABEL_LENGTH) { + keystore.setLabel(keystore.getLabel().substring(0, Keystore.MAX_LABEL_LENGTH)); + } + wallet.getKeystores().add(keystore); ExtendedKey.Header xpubHeader = ExtendedKey.Header.fromExtendedKey(ek.xpub);