Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2: Implement Extractor and Finalizer roles #16

Merged
merged 4 commits into from
Jan 31, 2024
Merged

Conversation

tcharding
Copy link
Owner

@tcharding tcharding commented Jan 30, 2024

3 preparator patches then a big one adding Extrator and Finalizer types that wrap Psbt. There are a ton of TODOs introduced with this PR.

The errors probably need some polishing, I'm particularly unimpressed with only being able to derive Debug on loads of them.

The current v0 extractor code only works for the happy path, it does not
do checks on the input PSBT as specified by the bip.

Add a TODO and also copy the relevant text from bip-174.
This code was just cut'n'paste and isn't currently being built. Just
delete it and we will start from scratch.
Add two methods to the `InputBuilder` to add funding utxos. Note that it
would really be better to use the type system to enforce existence of
the funding utxo but doing so would take us away from `Input` being a
1-1 representation of the bip.
Add types for the two new roles. Feature gate the `Finalizer` on
"miniscript". Because another entity may be the Finalizer do not feature
gate the `Extractor` oven thought transaction extraction is only
possible for a finalized PSBT.
@DanGould
Copy link
Collaborator

DanGould commented Jan 31, 2024

Extractor should be prioritized and finalizer deprioritized.

rust-bitcoin got away without a finalizer for life so far, so this could start by continuing to ignore it to get a workable v2, if it introduces too many TODOs. In payjoin-cli PSBTs get sent to bitcoind to be finalized. It just extracts a tx to broadcast from that external finalizer. A missing finalizer still makes for a useful library.

@tcharding
Copy link
Owner Author

tcharding commented Jan 31, 2024

Oh sweet! Extractor role is simple and it is done by this PR, with one caveat:

            // TODO: Check this MAX is correct.
            sequence: self.sequence.unwrap_or(Sequence::MAX),

@tcharding tcharding merged commit 8731df2 into master Jan 31, 2024
4 checks passed
@tcharding tcharding deleted the 01-13-extract branch January 31, 2024 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants