disable the locktime controls for a psbt input requiring a locktime, and show the locktime that will be signed
What changed, and why it matters
This commit changes how Sparrow Wallet handles 'locktime' settings when editing a transaction that came from a PSBT (Partially Signed Bitcoin Transaction). Previously, the user could edit the locktime even when a PSBT input required a specific locktime, which could lead to the wallet displaying or signing a different locktime than the one required by the transaction's inputs. Now, the locktime controls are disabled when any PSBT input requires a locktime, and the displayed locktime is forced to the value that will actually be signed. This is a defensive UI fix to prevent user confusion and potential signing of an unexpected transaction locktime.
Treat as a low-severity hardening/UI fix. Review related locktime handling in PSBT signing flow to ensure no other editable fields can diverge from required PSBT input constraints. No urgent action required unless additional evidence shows this could be exploited to trick users into signing unintended transactions.
Security signals we found
UI control disabled to prevent user override of protocol-required transaction field
Displayed locktime synchronized with value that will be signed
PSBT input-level required locktime honored over user-editable fallback locktime
Evidence from the diff
In HeadersController.java, setTransactionLocktime() now resets tx.locktime to the PSBT transaction’s locktime after setting the fallback locktime, ensuring the displayed/signed locktime matches the PSBT’s required locktime. updateEditable() now computes requiredLocktime by checking if any PSBT input has a non-null required time-based or height-based locktime, and disables the locktime type controls when requiredLocktime is true. This prevents users from overriding a locktime that is mandated by PSBT inputs.
Changed components
Sparrow Wallet desktop applicationHeadersController.javaPSBT transaction editor / locktime controlsInspect captured patch +4 / −1
### src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java
@@ -289,6 +289,7 @@ private void setTransactionLocktime(Transaction tx, long locktime) {
tx.setLocktime(locktime);
if(headersForm.getPsbt() != null) {
headersForm.getPsbt().setFallbackLocktime(locktime);
+ tx.setLocktime(headersForm.getPsbt().getTransaction().getLocktime());
}
}
@@ -877,7 +878,9 @@ private BlockTransactionHashIndex getBlockTransactionOutput(TransactionOutput tx
private void updateEditable(boolean editable) {
version.setDisable(!editable);
- boolean locktimeEnabled = editable && headersForm.getTransaction().isLocktimeSequenceEnabled();
+ boolean requiredLocktime = headersForm.getPsbt() != null
+ && headersForm.getPsbt().getPsbtInputs().stream().anyMatch(psbtInput -> psbtInput.getRequiredTimeLocktime() != null || psbtInput.getRequiredHeightLocktime() != null);
+ boolean locktimeEnabled = editable && headersForm.getTransaction().isLocktimeSequenceEnabled() && !requiredLocktime;
locktimeNoneType.setDisable(!locktimeEnabled);
locktimeBlockType.setDisable(!locktimeEnabled);
locktimeDateType.setDisable(!locktimeEnabled);Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.