Skip to content

Commit

Permalink
add warning when sighash none is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
craigraw committed Sep 16, 2024
1 parent e44d139 commit 8d7308b
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,16 @@ public SigHash fromString(String string) {
}
});
sigHash.valueProperty().addListener((observable, oldValue, newValue) -> {
if(newValue == SigHash.NONE || newValue == SigHash.ANYONECANPAY_NONE) {
Optional<ButtonType> optType = AppServices.showWarningDialog("Confirm Sighash None",
"A sighash value of none means the signature does not commit to any of the outputs, and can be reused on a transaction with different outputs.\n\nAre you sure?",
ButtonType.NO, ButtonType.YES);
if(optType.isPresent() && optType.get() == ButtonType.NO) {
Platform.runLater(() -> sigHash.getSelectionModel().select(oldValue));
return;
}
}

for(PSBTInput psbtInput : psbt.getPsbtInputs()) {
psbtInput.setSigHash(newValue == SigHash.DEFAULT && !psbtInput.isTaproot() ? SigHash.ALL : newValue);
}
Expand Down

0 comments on commit 8d7308b

Please sign in to comment.