mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-10 16:43:14 +00:00
add warning when sighash none is selected
This commit is contained in:
@@ -522,6 +522,16 @@ public class HeadersController extends TransactionFormController implements Init
|
||||
}
|
||||
});
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user