Treat PSBT version as a minimum and auto-bump for CSV#85
Open
ANAMASGARD wants to merge 1 commit into
Open
Conversation
Rename PsbtParams::version to PsbtParams::min_version and treat it as a lower bound. Selected inputs with relative timelocks (CSV) or AFS sequence-path selection now automatically raise the transaction version to Version::TWO. Remove the UnsupportedVersion error path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59
Description
This PR fixes #59 by treating the transaction version in
PsbtParamsas a minimum version instead of an exact version.Previously, transaction creation could fail when a selected input or anti-fee-sniping strategy required transaction version 2, but the caller requested version 1.
Now, the transaction version is automatically raised when required.
This PR:
PsbtParams::versiontoPsbtParams::min_version.Version::TWOwhen a selected input requires CSV.Version::TWOwhen anti-fee-sniping selects thenSequencepath.AntiFeeSnipingError::UnsupportedVersion.Notes to the reviewers
min_versionis treated only as a lower bound.For example:
min_version: Version::ONEwith no CSV input remains version 1.min_version: Version::ONEwith a CSV input becomes version 2.nLockTimepath does not unnecessarily raise the version.nSequencepath raises the version to 2 when required.The AFS sequence-path regression test uses a deterministic RNG so it does not depend on random branch selection.
Changelog notice
PsbtParams::versiontoPsbtParams::min_version.nSequencepath.Verification
The following checks passed:
cargo check --no-default-featurescurrently fails insideminiscriptbecause neither itsstdnorno-stdfeature is enabled. This appears to be an existing dependency-feature configuration issue and is unrelated to this change.Before submitting