add all whirlpool accounts if any one is discovered on wallet import

This commit is contained in:
Craig Raw 2022-07-07 15:18:19 +02:00
parent 930e36fa2b
commit c2eb505bd9
3 changed files with 14 additions and 3 deletions

2
drongo

@ -1 +1 @@
Subproject commit 1a20e0381c8961d51e5ccef04e3d47d41cec9388
Subproject commit d05ec39df7d7c8d23f61f39338c467b9507f0aaa

View file

@ -1014,7 +1014,9 @@ public class AppController implements Initializable {
for(Map.Entry<WalletAndKey, Storage> entry : walletAndKey.getChildWallets().entrySet()) {
openWallet(entry.getValue(), entry.getKey(), walletAppController, true);
}
Platform.runLater(() -> selectTab(walletAndKey.getWallet()));
if(walletAndKey.getWallet().isMasterWallet()) {
Platform.runLater(() -> selectTab(walletAndKey.getWallet()));
}
} catch(Exception e) {
log.error("Error opening wallet", e);
showErrorDialog("Error Opening Wallet", e.getMessage());

View file

@ -1587,17 +1587,26 @@ public class ElectrumServer {
if(nodeTransactionMap.values().stream().anyMatch(blockTransactionHashes -> !blockTransactionHashes.isEmpty())) {
Wallet masterWalletCopy = wallet.copy();
List<StandardAccount> searchAccounts = getStandardAccounts(wallet);
Set<StandardAccount> foundAccounts = new LinkedHashSet<>();
for(int j = 0; j < searchAccounts.size(); j++) {
StandardAccount standardAccount = searchAccounts.get(j);
Wallet childWallet = masterWalletCopy.addChildWallet(standardAccount);
Map<WalletNode, Set<BlockTransactionHash>> childTransactionMap = new TreeMap<>();
electrumServer.getReferences(childWallet, childWallet.getNode(KeyPurpose.RECEIVE).getChildren(), childTransactionMap, 0);
if(childTransactionMap.values().stream().anyMatch(blockTransactionHashes -> !blockTransactionHashes.isEmpty())) {
wallet.addChildWallet(standardAccount);
if(StandardAccount.WHIRLPOOL_ACCOUNTS.contains(standardAccount)) {
foundAccounts.addAll(StandardAccount.WHIRLPOOL_ACCOUNTS);
} else {
foundAccounts.add(standardAccount);
}
}
updateProgress(i + j, wallets.size() + StandardAccount.values().length);
}
for(StandardAccount standardAccount : foundAccounts) {
wallet.addChildWallet(standardAccount);
}
return Optional.of(wallet);
}
}