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

fixup: include specifier for how elements -> witness_data #17

Open
wants to merge 20 commits into
base: nifty/dual-fund
Choose a base branch
from

Conversation

niftynei
Copy link
Owner

@niftynei niftynei commented Jul 7, 2023

Clarify how witness data gets packed for plebs like me.

I do find it kind of odd that we also strip off the count bits but we end up having to "re-hydrate" this struct back into CompactSize-less scripts in order to jam it into our own wallet/struct stuff so honestly let's maybe not go there.

niftynei and others added 20 commits June 29, 2023 14:05
This commit adds the interactive transaction construction protcol, as
well as the first practical example of using it, v2 of channel
establishment.

Note that for v2 we also update the channel_id, which now uses the hash
of the revocation_basepoints. We move away from using the funding
transaction id, as the introduction of RBF* makes it such that a single
channel may have many funding transaction id's over the course of
its lifetime.

*Later, also splicing
If both peers contribute an equal amount to a interactive tx,
peer with "lower" pubkey sends first
This commit contains many (small) changes to address most of the pending
comments:

- removed feature dependency on anchor outputs
- the "zerod_channel_id" created confusion, we instead explicitly detail
  the open and accept cases
- "fail the negotiation" was unclear in interactive-tx
- clarified field names in `tx_signatures`
- many nits from PR comments

Thanks to @morehouse, @ariard and @antonilol for the helpful comments.
Repeat the second commit point in the initial openchannel2 message.

Suggested-By: @pm47
Prior versions of the v2 dual-funding protocol assumed a 'minimum fee'
payment for any witness stack of any input, as a way to simplify fee
checks.

The suggested min feerate didn't make sense for taproot spend paths etc;
instead we remove this check entirely.
This lets any side of the protocol require the other side to use confirmed
inputs, to avoid paying the fees of a low feerate unconfirmed ancestor.
This allows us to filter messages until we know the peer has ack'd our
abort, allowing us to return to "prior" negotiation state w/o fear of
encountering stale messages in the queue.

Suggested-by: @ddustin
Same argument as for including it in open_channel2
This issue is non-trivial and worth mentioning, otherwise implementations
may forget to handle this which would result in an easy way of attacking
node's on-chain liquidity, creating a large opportunity cost.
If we only store state when sending `tx_signatures`, there are cases where
we cannot reconcile states if a disconnection occurs during the signing
steps: one side will have sent `tx_signatures` and thus must wait for the
transaction to be spent or double-spent, while the other side has already
forgotten that channel because they haven't sent `tx_signatures`.

This is fixed by storing state when sending `commitment_signed`, and
adding a `next_funding_txid` field to `channel_reestablish` to ask our
peer to retransmit signatures that we haven't received.
While dual funding only needs unsigned funding amounts, other protocols
that leverage interactive-tx may use signed funding amounts, for example
to take funds out of an existing channel (splice-out).

It is thus more future-proof to use signed amounts in `tx_init_rbf` and
`tx_ack_rbf`.
Clarify how witness data gets packed for plebs like me
@niftynei niftynei force-pushed the nifty/clarify-witness-data branch from 3efee3c to e299850 Compare July 7, 2023 05:41
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.

3 participants