Skip to content

Add .weight() for transaction components #1411

@LLFourn

Description

@LLFourn

In rust-bitcoin/rust-miniscript#476 we're sensibly changing the definition of max_satisfaction_weight to "how much more weight would satisfying this input add over TxIn::default()" but it occurred to me that we don't have a .weight() function on TxIn. I think it would be good if TxInto make this a little more concrete.
While we're there I think we might as well add it to TxOut too.

Of course we should stress in the docs that adding a TxIn (or TxOut) to the transaction does not necessarily mean that onlyTxIn::weight() is being added to the total -- it might be more if (i) that TxIn is a segwit input and there have been no segwit inputs added so far and (ii) if it causes the varint length to increase (which is applicable to TxOut too).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions