Browse Source

deduplicate output descriptors for bwt

terminal
Craig Raw 4 years ago
parent
commit
3b3e46983f
  1. 2
      drongo
  2. 6
      src/main/java/com/sparrowwallet/sparrow/net/Bwt.java

2
drongo

@ -1 +1 @@
Subproject commit 49654b7c82d104f7898eff95f0ac3cec96fbc0ec Subproject commit 428054d375b638bb7e08133fdffe6f1dd438cca9

6
src/main/java/com/sparrowwallet/sparrow/net/Bwt.java

@ -58,7 +58,7 @@ public class Bwt {
private void start(Collection<Wallet> wallets, CallbackNotifier callback) { private void start(Collection<Wallet> wallets, CallbackNotifier callback) {
List<Wallet> validWallets = wallets.stream().filter(Wallet::isValid).collect(Collectors.toList()); List<Wallet> validWallets = wallets.stream().filter(Wallet::isValid).collect(Collectors.toList());
List<String> outputDescriptors = new ArrayList<>(); Set<String> outputDescriptors = new LinkedHashSet<>();
for(Wallet wallet : validWallets) { for(Wallet wallet : validWallets) {
OutputDescriptor receiveOutputDescriptor = OutputDescriptor.getOutputDescriptor(wallet, KeyPurpose.RECEIVE); OutputDescriptor receiveOutputDescriptor = OutputDescriptor.getOutputDescriptor(wallet, KeyPurpose.RECEIVE);
outputDescriptors.add(receiveOutputDescriptor.toString(false, false)); outputDescriptors.add(receiveOutputDescriptor.toString(false, false));
@ -89,7 +89,7 @@ public class Bwt {
* @param gapLimit desired gap limit beyond last used address * @param gapLimit desired gap limit beyond last used address
* @param callback object receiving notifications * @param callback object receiving notifications
*/ */
private void start(List<String> outputDescriptors, Integer rescanSince, Boolean forceRescan, Integer gapLimit, CallbackNotifier callback) { private void start(Collection<String> outputDescriptors, Integer rescanSince, Boolean forceRescan, Integer gapLimit, CallbackNotifier callback) {
BwtConfig bwtConfig = new BwtConfig(); BwtConfig bwtConfig = new BwtConfig();
bwtConfig.network = Network.get() == Network.MAINNET ? "bitcoin" : Network.get().getName(); bwtConfig.network = Network.get() == Network.MAINNET ? "bitcoin" : Network.get().getName();
@ -188,7 +188,7 @@ public class Bwt {
public Boolean createWalletIfMissing; public Boolean createWalletIfMissing;
@SerializedName("descriptors") @SerializedName("descriptors")
public List<String> descriptors; public Collection<String> descriptors;
@SerializedName("xpubs") @SerializedName("xpubs")
public String xpubs; public String xpubs;

Loading…
Cancel
Save