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

descriptors: fix max satisfaction weight for Taproot multisig primary path spends #1451

Merged

Conversation

jp1ac4
Copy link
Collaborator

@jp1ac4 jp1ac4 commented Nov 8, 2024

This is a fix to #1371 and the related #1322.

As per #1371 (comment), this adds the varint length for the script and control block elements of a Taproot primary path spend.

I think this is what caused #1322 and so I have reverted the change from #1323.

This includes the sizes of the script and control block elements.
This reverts commit 74a53ba.

I also removed the extra sats being added in the functional test.
Comment on lines +284 to +288
// We need to calculate the size manually before calculating the varint length.
// See https://docs.rs/miniscript/11.0.0/src/miniscript/util.rs.html#35-36.
Placeholder::TapScript(s) => varint_len(s.len()),
Placeholder::TapControlBlock(cb) => varint_len(cb.serialize().len()),
_ => 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So any stack item but the leaf script and control block account for the varint length? This is incredibly confusing, it'd be worth opening an issue there. (And if they fix it it would be nice to also fix rust-bitcoin/rust-miniscript#701.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears so. I did some debugging to inspect all the elements and their sizes against an actual transaction and the sizes of these two placeholder elements didn't include the varint lengths.

I've created rust-bitcoin/rust-miniscript#771 to track this.

@darosior
Copy link
Member

darosior commented Nov 8, 2024

light-ACK. The code looks correct to me but i haven't reviewed the test nor reviewed in depth but from a quick skim of their codebase it seems correct.

@edouardparis
Copy link
Member

From Andrew Poelstra comment: rust-bitcoin/rust-miniscript#771, the issue is acknowledged and it seems you are on the good track. I am okay to proceed to merge these changes.

Copy link
Member

@edouardparis edouardparis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 6e74a96

@edouardparis edouardparis merged commit cfe653f into wizardsardine:master Nov 15, 2024
31 checks passed
@jp1ac4 jp1ac4 deleted the desc-fix-satisfaction-weight-for-tr branch November 15, 2024 13:44
edouardparis added a commit that referenced this pull request Nov 18, 2024
e4ae6dc descriptors: include segwit marker and flag (Michael Mallan)
03a3230 descriptors: add method to get max tx weight (Michael Mallan)

Pull request description:

  This fixes #1406, building on the fix from #1451 for estimating the weight of each input.

  An extra 2 is added to the unsigned transaction's weight to account for the Segwit marker and flag.

ACKs for top commit:
  edouardparis:
    utACK e4ae6dc

Tree-SHA512: de78763d85ed38d5e2797d6f95b1ef293bbedf3cd4d5d1f69085bd134a117ae270a24c3487d738398191fb4126c4f8319bba53b902cec1625dad1c501f3f2aa9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants