Skip to content

Commit

Permalink
lnwire: add function to easily construct DynCommit
Browse files Browse the repository at this point in the history
  • Loading branch information
ProofOfKeags committed Oct 2, 2024
1 parent 2e18a7c commit 4d39ed7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lnwire/dyn_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,20 @@ func (dc *DynCommit) Decode(r io.Reader, _ uint32) error {
func (dc *DynCommit) MsgType() MessageType {
return MsgDynCommit
}

// NegotiateDynCommit constructs a DynCommit message from the prior DynPropose
// and DynAck messages exchanged during the negotiation.
func NegotiateDynCommit(propose DynPropose, ack DynAck) DynCommit {
return DynCommit{
ChanID: propose.ChanID,
Sig: ack.Sig,
DustLimit: propose.DustLimit,
MaxValueInFlight: propose.MaxValueInFlight,
ChannelReserve: propose.ChannelReserve,
CsvDelay: propose.CsvDelay,
MaxAcceptedHTLCs: propose.MaxAcceptedHTLCs,
FundingKey: propose.FundingKey,
ChannelType: propose.ChannelType,
KickoffFeerate: propose.KickoffFeerate,
}
}

0 comments on commit 4d39ed7

Please sign in to comment.