Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Conversation

@Vib-UX
Copy link
Contributor

@Vib-UX Vib-UX commented Jul 23, 2021

wire: create closing_signed message type #180

BOLT #2

  • Parameters are defined according to closing_signed in BOLT #2
  • Implementation is as per the standards given
  • UT attached for testing

@bmancini55

@Vib-UX Vib-UX closed this Jul 24, 2021
@Vib-UX Vib-UX reopened this Jul 24, 2021
Copy link
Member

@bmancini55 bmancini55 left a comment

Choose a reason for hiding this comment

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

Code structure looks good! Couple minors on commenting the protocol.

"0027"+ // type
"0000000000000000000000000000000000000000000000000000000000000000" + // Channel ID
"0000000000030d40" + // feeSatoshi
"22222222222222222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333333333333333333333" //signature
Copy link
Member

Choose a reason for hiding this comment

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

nit: fix whitespace



/**
*/
Copy link
Member

Choose a reason for hiding this comment

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

Add comment on the purpose of this message and include when we send it and when we expect to receive it.

Copy link
Member

Choose a reason for hiding this comment

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

Looks good, but let's add two more things:

  • purpose of fee negotiation
  • how fee rate is convergent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Maybe I am wrong, isn't the purpose for fee negotiation is that how fast one of the two side wants the transaction to be included in the block?
  2. As for the Fee rate convergence, On every negotiation step we must give up some amount from our proposal towards the other peer’s proposal. Eg. assuming the peer proposes a closing fee of 3000 satoshi and our estimate shows it must be 4000. “10”: our next proposal will be 4000-10=3990. This exchange continues using the channelID until both agree on the same fee or when one side fails the channel.

Should I update the nxt commit using the above points?

References :

  1. https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed
  2. https://lightning.readthedocs.io/lightning-close.7.html

Copy link
Member

Choose a reason for hiding this comment

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

Re 1: For mutual close both sides want the transaction in with minimal fees. Without anchors, the feerate_per_kw set at open or through update_fee is suggested to be 5x the amount that will get the transaction included in the block, which is extremely expensive. One of the benefits of mutual close is that the fee rate can be negotiated down from the existing fee rate to a more reasonable one.

Re 2: Correct, though you may want to say that it is convergent by requiring the fee rate to be strictly between the last proposed and the counterparty's last proposed value. The back and forth continues until values are equal, at which point both sides can broadcast the closing tx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's very informative. Wasn't aware that initial fee kept or suggested is that high! Thanks

public static type: MessageType = MessageType.ClosingSigned;

/**
* Deserializes the funding_signed message
Copy link
Member

Choose a reason for hiding this comment

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

closing_signed message

public channelId: ChannelId;

/**
* fee_satoshis is set according to its estimate of cost of inclusion in a block.
Copy link
Member

Choose a reason for hiding this comment

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

Include comments about the expected value when sending or receiving.

Copy link
Member

@bmancini55 bmancini55 left a comment

Choose a reason for hiding this comment

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

Looking good with a couple small changes



/**
*/
Copy link
Member

Choose a reason for hiding this comment

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

Looks good, but let's add two more things:

  • purpose of fee negotiation
  • how fee rate is convergent

/**
* Expected value for fee_satoshis could vary how fast either side wants the transaction
* to be included in the block. So changes are made accordingly on both ends and communicated
* between the channel untill both of them comes to an agreement or when one side fails the
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/untill/until/

Copy link
Member

@bmancini55 bmancini55 left a comment

Choose a reason for hiding this comment

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

Looks good!

@bmancini55 bmancini55 marked this pull request as ready for review July 30, 2021 12:44
@bmancini55 bmancini55 merged commit a95e7d5 into node-lightning:main Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants