Skip to content

Add the "planning" module#481

Closed
afilini wants to merge 6 commits intorust-bitcoin:masterfrom
afilini:planning-module
Closed

Add the "planning" module#481
afilini wants to merge 6 commits intorust-bitcoin:masterfrom
afilini:planning-module

Conversation

@afilini
Copy link
Copy Markdown
Contributor

@afilini afilini commented Oct 25, 2022

This PR modifies the satisfaction logic so that instead of building a full witness it builds "witness templates", essentially containing placeholders instead of the actual signatures/preimages.

Once you have a "witness template" you can then analyze it (figure out the precise weight) and interactively (or in single shot) try to construct an actual witness by replacing the placeholders with actual values.

We introduce the AssetProvider trait which somewhat mirrors the Satisfier trait, but only returns whether something is available or not. For convenience the AssetProvider trait is automatically implemented for every Satisfier through a wrapping structure.

Finally, we also introduce the Assets structure which is a builder-like struct that implements the AssetProvider trait and can be used to easily tell miniscript which keys and preimages are available, or how long one is willing to wait for timelocks to expire. Using this, one can easily figure out, before creating a transaction, how much the witness is going to weight and what nLockTime/nSequence should be set in the transaction assuming those assets will be available later for signing.

The commits are co-authored by @danielabrozzoni since we've both worked together on this on and off for the past couple of weeks.

Loading
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.

7 participants