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 c3ac046f..48299fa3 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/main/.DS_Store b/src/main/.DS_Store new file mode 100644 index 00000000..db3318cb Binary files /dev/null and b/src/main/.DS_Store differ 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 43571ed0..78c4b064 100644 Binary files a/src/main/resources/.DS_Store and b/src/main/resources/.DS_Store differ diff --git a/src/test/resources/.DS_Store b/src/test/resources/.DS_Store index 3ff3e4ce..8c4069f8 100644 Binary files a/src/test/resources/.DS_Store and b/src/test/resources/.DS_Store differ