signing multisig fixes

This commit is contained in:
Craig Raw 2020-07-30 15:58:19 +02:00
parent c9d7b03afc
commit 928731b383
8 changed files with 32 additions and 16 deletions

2
drongo

@ -1 +1 @@
Subproject commit 4b4a980a9bead1589a1db4202ac5ed386832f4ab Subproject commit 4c5166a6ea886622d57254444e95efa043ba302f

BIN
src/.DS_Store vendored

Binary file not shown.

BIN
src/main/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -34,10 +34,7 @@ public class BalanceChart extends LineChart<Number, Number> {
} }
public void update(WalletTransactionsEntry walletTransactionsEntry) { public void update(WalletTransactionsEntry walletTransactionsEntry) {
if(walletTransactionsEntry.getChildren().isEmpty()) { setVisible(!walletTransactionsEntry.getChildren().isEmpty());
setVisible(false);
}
balanceSeries.getData().clear(); balanceSeries.getData().clear();
List<Data<Number, Number>> balanceDataList = walletTransactionsEntry.getChildren().stream() List<Data<Number, Number>> balanceDataList = walletTransactionsEntry.getChildren().stream()

View file

@ -197,14 +197,7 @@ public class HeadersController extends TransactionFormController implements Init
}); });
version.setDisable(!headersForm.isEditable()); version.setDisable(!headersForm.isEditable());
String type = "Legacy"; updateType();
if(tx.isSegwit()) {
type = "Segwit";
if(tx.getSegwitVersion() == 2) {
type = "Taproot";
}
}
segwit.setText(type);
locktimeToggleGroup.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> { locktimeToggleGroup.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> {
if(locktimeToggleGroup.getSelectedToggle() != null) { if(locktimeToggleGroup.getSelectedToggle() != null) {
@ -286,8 +279,7 @@ public class HeadersController extends TransactionFormController implements Init
locktimeBlock.setDisable(!headersForm.isEditable()); locktimeBlock.setDisable(!headersForm.isEditable());
locktimeDate.setDisable(!headersForm.isEditable()); locktimeDate.setDisable(!headersForm.isEditable());
size.setText(tx.getSize() + " B"); updateSize();
virtualSize.setText(tx.getVirtualSize() + " vB");
Long feeAmt = null; Long feeAmt = null;
if(headersForm.getPsbt() != 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<Sha256Hash, BlockTransaction> inputTransactions) { private Long calculateFee(Map<Sha256Hash, BlockTransaction> inputTransactions) {
long feeAmt = 0L; long feeAmt = 0L;
for(TransactionInput input : headersForm.getTransaction().getInputs()) { for(TransactionInput input : headersForm.getTransaction().getInputs()) {
@ -551,6 +559,10 @@ public class HeadersController extends TransactionFormController implements Init
return; return;
} }
if(headersForm.getPsbt().isSigned()) {
return;
}
Wallet copy = headersForm.getSigningWallet().copy(); Wallet copy = headersForm.getSigningWallet().copy();
File file = headersForm.getAvailableWallets().get(headersForm.getSigningWallet()).getWalletFile(); File file = headersForm.getAvailableWallets().get(headersForm.getSigningWallet()).getWalletFile();
@ -590,6 +602,10 @@ public class HeadersController extends TransactionFormController implements Init
return; return;
} }
if(headersForm.getPsbt().isSigned()) {
return;
}
DeviceSignDialog dlg = new DeviceSignDialog(headersForm.getPsbt()); DeviceSignDialog dlg = new DeviceSignDialog(headersForm.getPsbt());
Optional<PSBT> optionalSignedPsbt = dlg.showAndWait(); Optional<PSBT> optionalSignedPsbt = dlg.showAndWait();
if(optionalSignedPsbt.isPresent()) { if(optionalSignedPsbt.isPresent()) {
@ -789,6 +805,9 @@ public class HeadersController extends TransactionFormController implements Init
public void transactionExtracted(TransactionExtractedEvent event) { public void transactionExtracted(TransactionExtractedEvent event) {
if(event.getPsbt().equals(headersForm.getPsbt())) { if(event.getPsbt().equals(headersForm.getPsbt())) {
updateTxId(); updateTxId();
updateType();
updateSize();
updateFee(headersForm.getPsbt().getFee());
} }
} }

View file

@ -191,7 +191,7 @@ public class WalletForm {
@Subscribe @Subscribe
public void newBlock(NewBlockEvent event) { public void newBlock(NewBlockEvent event) {
updateWallet(wallet, event.getHeight()); updateWallet(wallet.copy(), event.getHeight());
} }
@Subscribe @Subscribe

Binary file not shown.

Binary file not shown.