mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 12:26:45 +00:00
add warning when sighash none is selected
This commit is contained in:
parent
e44d1393f5
commit
8d7308bc37
1 changed files with 10 additions and 0 deletions
|
@ -522,6 +522,16 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sigHash.valueProperty().addListener((observable, oldValue, newValue) -> {
|
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()) {
|
for(PSBTInput psbtInput : psbt.getPsbtInputs()) {
|
||||||
psbtInput.setSigHash(newValue == SigHash.DEFAULT && !psbtInput.isTaproot() ? SigHash.ALL : newValue);
|
psbtInput.setSigHash(newValue == SigHash.DEFAULT && !psbtInput.isTaproot() ? SigHash.ALL : newValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue