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

Add a commitment feerate parameter to multifundchannel #4139

Merged

Conversation

niftynei
Copy link
Collaborator

@niftynei niftynei commented Oct 19, 2020

This lets a caller of multifundchannel specify a separate feerate for the channel's initial commitment transaction. This separates it from the feerate used for the funding transaction.

Writing the test for this uncovered an off by one in how we were calculating signature lengths.

Note that this conforms with the interface for openchannel_init, the new RPC that will initiate a v2 channel open (which contains two separate feerates, one for the funding tx and another for the commitment txs)

size_t bitcoin_tx_input_sig_weight(void)
{
return 1 + 71 + 1;
return 1 + 71;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you overlooked the length prefix.

length prefix + sig + sighash_flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sighash_flag is included in the 71 count, see commit message

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, right!

Technically there *are* two feerates that we need to know:
  - the feerate to use for the funding transaction, and
  - the feerate to tell our peer to use for our commitment txs/htlc txs

As written, `multifundchannel` uses the same feerate for both. This
optional parameter will allow us to differentiate between the two, which
will be exceedingly handy for anchor output worlds. ;)

FIXME: test this

Changelog-Added: JSON API: `multifundchannel` has a new optional argument, 'commitment_feerate', which can be used to differentiate between the funding feerate and the channel's initial commitment feerate
reduce, reuse, recycle for a greener world
71-bytes for a signature already includes the sighash byte.

 2-bytes	30 44 (DER- prefix thing)
34-bytes	02 20 6e29c8df67fffdda1613cef1413eb1a9ef3627f1fc5e4d910837274eafcc7b2a (r)
34-bytes	02 20 4b8563d79b92fdd830a546862439f80b24132d09318af2c7220c791067067e29 (s)
 1-byte		01 (sighash)
==
71-bytes
Liquid is excluded because the mempool entry doesn't contain a 'weight'
field.
Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

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

Ack a45b7a2

@rustyrussell rustyrussell merged commit ede5f5b into ElementsProject:master Oct 21, 2020
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