From 928731b383714569cbebb0106354240cd337092e Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 30 Jul 2020 15:58:19 +0200 Subject: [PATCH] signing multisig fixes --- drongo | 2 +- src/.DS_Store | Bin 6148 -> 6148 bytes src/main/.DS_Store | Bin 0 -> 6148 bytes .../sparrow/control/BalanceChart.java | 5 +-- .../transaction/HeadersController.java | 39 +++++++++++++----- .../sparrow/wallet/WalletForm.java | 2 +- src/main/resources/.DS_Store | Bin 6148 -> 6148 bytes src/test/resources/.DS_Store | Bin 6148 -> 6148 bytes 8 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 src/main/.DS_Store diff --git a/drongo b/drongo index 4b4a980a..4c5166a6 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 4b4a980a9bead1589a1db4202ac5ed386832f4ab +Subproject commit 4c5166a6ea886622d57254444e95efa043ba302f diff --git a/src/.DS_Store b/src/.DS_Store index c3ac046f6c51a2cd4bc2df32c603e493458c382e..48299fa3419bd1468f9f3c8cb2ae052421e873e6 100644 GIT binary patch delta 108 zcmZoMXfc=|&e%3FQH+&?fq{WzVxkBq6OaJ{OcMjFML`@EhFpe3hD?UMw3OoHr2PDx yiP|z7)4kaz8;G!M=H}qxU~Jo%_?>w&zlb7Oy#i2A0uVC-@c|%a*z72>pBVtGv=wpy delta 71 zcmZoMXfc=|&Zs&uQF!748BQh!2w8zIs3#5uAA981UMK~Hy-@XJeglak&_Xq UA_1govI&p!<^+)?%o7V(0EP(>ivR!s diff --git a/src/main/.DS_Store b/src/main/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..db3318cb708cba26a845ac0871e6aa71911cdb82 GIT binary patch literal 6148 zcmeHKISv9b477m)M6)GjzQ7M61TWwNh^syNL4(GUGl}C#lquG0 z5z)nUKNo34WDGZyn+<)lee<3TGNM2@&bZ21c5;x*ao@{+A299&EO4ZK=3jQ(wmsQ4 zjS5f!DnJFO02TP60$E(g(=VRMqo@EC_zwl_`%vJ9HL(lyPX`8X0e~Zf-7xoF0$3~n ztchJ9A}|dqFsPa>h6Ww+l6f_;3k7q4|BNduOzOh02TNv1$4ArFBf=H*4EzRtkxFz25vcbxEbb7!QkZ>=;as-E5|cWio9ZT X?AOFD(CLUf9mt;n(}hL_eyzX*QeqXW literal 0 HcmV?d00001 diff --git a/src/main/java/com/sparrowwallet/sparrow/control/BalanceChart.java b/src/main/java/com/sparrowwallet/sparrow/control/BalanceChart.java index 1f10a5b3..c7172eb2 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/BalanceChart.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/BalanceChart.java @@ -34,10 +34,7 @@ public class BalanceChart extends LineChart { } public void update(WalletTransactionsEntry walletTransactionsEntry) { - if(walletTransactionsEntry.getChildren().isEmpty()) { - setVisible(false); - } - + setVisible(!walletTransactionsEntry.getChildren().isEmpty()); balanceSeries.getData().clear(); List> balanceDataList = walletTransactionsEntry.getChildren().stream() diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index 16b3ba5d..5d58a605 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -197,14 +197,7 @@ public class HeadersController extends TransactionFormController implements Init }); version.setDisable(!headersForm.isEditable()); - String type = "Legacy"; - if(tx.isSegwit()) { - type = "Segwit"; - if(tx.getSegwitVersion() == 2) { - type = "Taproot"; - } - } - segwit.setText(type); + updateType(); locktimeToggleGroup.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> { if(locktimeToggleGroup.getSelectedToggle() != null) { @@ -286,8 +279,7 @@ public class HeadersController extends TransactionFormController implements Init locktimeBlock.setDisable(!headersForm.isEditable()); locktimeDate.setDisable(!headersForm.isEditable()); - size.setText(tx.getSize() + " B"); - virtualSize.setText(tx.getVirtualSize() + " vB"); + updateSize(); Long feeAmt = null; if(headersForm.getPsbt() != null) { @@ -373,6 +365,22 @@ public class HeadersController extends TransactionFormController implements Init } } + private void updateType() { + String type = "Legacy"; + if(headersForm.getTransaction().isSegwit() || (headersForm.getPsbt() != null && headersForm.getPsbt().getPsbtInputs().stream().anyMatch(in -> in.getWitnessUtxo() != null))) { + type = "Segwit"; + if(headersForm.getTransaction().getSegwitVersion() == 2) { + type = "Taproot"; + } + } + segwit.setText(type); + } + + private void updateSize() { + size.setText(headersForm.getTransaction().getSize() + " B"); + virtualSize.setText(headersForm.getTransaction().getVirtualSize() + " vB"); + } + private Long calculateFee(Map inputTransactions) { long feeAmt = 0L; for(TransactionInput input : headersForm.getTransaction().getInputs()) { @@ -551,6 +559,10 @@ public class HeadersController extends TransactionFormController implements Init return; } + if(headersForm.getPsbt().isSigned()) { + return; + } + Wallet copy = headersForm.getSigningWallet().copy(); File file = headersForm.getAvailableWallets().get(headersForm.getSigningWallet()).getWalletFile(); @@ -590,6 +602,10 @@ public class HeadersController extends TransactionFormController implements Init return; } + if(headersForm.getPsbt().isSigned()) { + return; + } + DeviceSignDialog dlg = new DeviceSignDialog(headersForm.getPsbt()); Optional optionalSignedPsbt = dlg.showAndWait(); if(optionalSignedPsbt.isPresent()) { @@ -789,6 +805,9 @@ public class HeadersController extends TransactionFormController implements Init public void transactionExtracted(TransactionExtractedEvent event) { if(event.getPsbt().equals(headersForm.getPsbt())) { updateTxId(); + updateType(); + updateSize(); + updateFee(headersForm.getPsbt().getFee()); } } diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java b/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java index 9cbbfc62..a11159ed 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java @@ -191,7 +191,7 @@ public class WalletForm { @Subscribe public void newBlock(NewBlockEvent event) { - updateWallet(wallet, event.getHeight()); + updateWallet(wallet.copy(), event.getHeight()); } @Subscribe diff --git a/src/main/resources/.DS_Store b/src/main/resources/.DS_Store index 43571ed0baa5ae03ed6efb5ab3eb99f64453385b..78c4b0643899a622fea98dde2462d697a1353091 100644 GIT binary patch delta 39 vcmZoMXfc@J&&a$nU^gQp^JX3z$H*|zUVdZZGWN;3BJ7*FIezj30AOtgj{pDw delta 26 icmZoMXfc>z$H+L*UY?P0W8yOQ$$BDeo4GlD@&f>7?FW(o