Browse Source

truncate long electrum wallet labels

terminal
Craig Raw 4 years ago
parent
commit
a9a3eef157
  1. 4
      src/main/java/com/sparrowwallet/sparrow/io/Electrum.java

4
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.setKeyDerivation(new KeyDerivation(masterFingerprint, derivationPath));
keystore.setExtendedPublicKey(xPub); keystore.setExtendedPublicKey(xPub);
keystore.setLabel(ek.label != null ? ek.label : "Electrum"); 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); wallet.getKeystores().add(keystore);
ExtendedKey.Header xpubHeader = ExtendedKey.Header.fromExtendedKey(ek.xpub); ExtendedKey.Header xpubHeader = ExtendedKey.Header.fromExtendedKey(ek.xpub);

Loading…
Cancel
Save