Skip to content

Commit dc92eee

Browse files
committed
lnwire: add function to easily construct DynCommit
1 parent 0030244 commit dc92eee

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lnwire/dyn_commit.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,20 @@ func (dc *DynCommit) Decode(r io.Reader, _ uint32) error {
278278
func (dc *DynCommit) MsgType() MessageType {
279279
return MsgDynCommit
280280
}
281+
282+
// NegotiateDynCommit constructs a DynCommit message from the prior DynPropose
283+
// and DynAck messages exchanged during the negotiation.
284+
func NegotiateDynCommit(propose DynPropose, ack DynAck) DynCommit {
285+
return DynCommit{
286+
ChanID: propose.ChanID,
287+
Sig: ack.Sig,
288+
DustLimit: propose.DustLimit,
289+
MaxValueInFlight: propose.MaxValueInFlight,
290+
ChannelReserve: propose.ChannelReserve,
291+
CsvDelay: propose.CsvDelay,
292+
MaxAcceptedHTLCs: propose.MaxAcceptedHTLCs,
293+
FundingKey: propose.FundingKey,
294+
ChannelType: propose.ChannelType,
295+
KickoffFeerate: propose.KickoffFeerate,
296+
}
297+
}

0 commit comments

Comments
 (0)