mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
increase gap limit where necessary to sign a psbt where global xpubs match
This commit is contained in:
parent
cb06e1aaf7
commit
f4ac18c3e1
2 changed files with 15 additions and 1 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
||||||
Subproject commit 12db57c8d75c6f9eb96a8da89e80139850cc450b
|
Subproject commit 75730f00ac9930c5800bd0868133903c90ce7930
|
|
@ -1364,6 +1364,20 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
public void openWallets(OpenWalletsEvent event) {
|
public void openWallets(OpenWalletsEvent event) {
|
||||||
if(id.getScene().getWindow().equals(event.getWindow()) && headersForm.getPsbt() != null && headersForm.getBlockTransaction() == null) {
|
if(id.getScene().getWindow().equals(event.getWindow()) && headersForm.getPsbt() != null && headersForm.getBlockTransaction() == null) {
|
||||||
List<Wallet> availableWallets = event.getWallets().stream().filter(wallet -> wallet.canSign(headersForm.getPsbt())).sorted(new WalletSignComparator()).collect(Collectors.toList());
|
List<Wallet> availableWallets = event.getWallets().stream().filter(wallet -> wallet.canSign(headersForm.getPsbt())).sorted(new WalletSignComparator()).collect(Collectors.toList());
|
||||||
|
if(availableWallets.isEmpty()) {
|
||||||
|
for(Wallet wallet : event.getWalletsMap().keySet()) {
|
||||||
|
if(wallet.isValid() && !wallet.getSigningKeystores(headersForm.getPsbt()).isEmpty()) {
|
||||||
|
int currentGapLimit = wallet.getGapLimit();
|
||||||
|
Integer requiredGapLimit = wallet.getRequiredGapLimit(headersForm.getPsbt());
|
||||||
|
if(requiredGapLimit != null && requiredGapLimit > currentGapLimit) {
|
||||||
|
wallet.setGapLimit(requiredGapLimit);
|
||||||
|
EventManager.get().post(new WalletGapLimitChangedEvent(event.getStorage(wallet).getWalletId(wallet), wallet, currentGapLimit));
|
||||||
|
Platform.runLater(() -> EventManager.get().post(new RequestOpenWalletsEvent()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<Wallet, Storage> availableWalletsMap = new LinkedHashMap<>(event.getWalletsMap());
|
Map<Wallet, Storage> availableWalletsMap = new LinkedHashMap<>(event.getWalletsMap());
|
||||||
availableWalletsMap.keySet().retainAll(availableWallets);
|
availableWalletsMap.keySet().retainAll(availableWallets);
|
||||||
headersForm.getAvailableWallets().keySet().retainAll(availableWallets);
|
headersForm.getAvailableWallets().keySet().retainAll(availableWallets);
|
||||||
|
|
Loading…
Reference in a new issue