@@ -18,6 +18,10 @@ const (
1818 // record for DynPropose.MaxValueInFlight.
1919 DPMaxHtlcValueInFlightMsat tlv.Type = 1
2020
21+ // DPHtlcMinimumMsat is the TLV type number that identifies the record
22+ // for DynPropose.HtlcMinimum.
23+ DPHtlcMinimumMsat tlv.Type = 7
24+
2125 // DPChannelReserveSatoshis is the TLV type number that identifies the
2226 // for DynPropose.ChannelReserve.
2327 DPChannelReserveSatoshis tlv.Type = 2
@@ -50,6 +54,10 @@ type DynPropose struct {
5054 // max_htlc_value_in_flight_msat limit of the sender.
5155 MaxValueInFlight fn.Option [MilliSatoshi ]
5256
57+ // HtlcMinimum, if not nil, proposes a change to the htlc_minimum_msat
58+ // floor of the sender.
59+ HtlcMinimum fn.Option [MilliSatoshi ]
60+
5361 // ChannelReserve, if not nil, proposes a change to the
5462 // channel_reserve_satoshis requirement of the recipient.
5563 ChannelReserve fn.Option [btcutil.Amount ]
@@ -106,6 +114,14 @@ func (dp *DynPropose) Encode(w *bytes.Buffer, _ uint32) error {
106114 ),
107115 )
108116 })
117+ dp .HtlcMinimum .WhenSome (func (min MilliSatoshi ) {
118+ protoSats := uint64 (min )
119+ tlvRecords = append (
120+ tlvRecords , tlv .MakePrimitiveRecord (
121+ DPHtlcMinimumMsat , & protoSats ,
122+ ),
123+ )
124+ })
109125 dp .ChannelReserve .WhenSome (func (min btcutil.Amount ) {
110126 channelReserve := uint64 (min )
111127 tlvRecords = append (
@@ -185,6 +201,11 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error {
185201 DPMaxHtlcValueInFlightMsat , & maxValueScratch ,
186202 )
187203
204+ var htlcMinScratch uint64
205+ htlcMin := tlv .MakePrimitiveRecord (
206+ DPHtlcMinimumMsat , & htlcMinScratch ,
207+ )
208+
188209 var reserveScratch uint64
189210 reserve := tlv .MakePrimitiveRecord (
190211 DPChannelReserveSatoshis , & reserveScratch ,
@@ -206,7 +227,8 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error {
206227
207228 // Create set of Records to read TLV bytestream into.
208229 records := []tlv.Record {
209- dustLimit , maxValue , reserve , csvDelay , maxHtlcs , chanType ,
230+ dustLimit , maxValue , htlcMin , reserve , csvDelay , maxHtlcs ,
231+ chanType ,
210232 }
211233 tlv .SortRecords (records )
212234
@@ -230,6 +252,9 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error {
230252 if val , ok := typeMap [DPMaxHtlcValueInFlightMsat ]; ok && val == nil {
231253 dp .MaxValueInFlight = fn .Some (MilliSatoshi (maxValueScratch ))
232254 }
255+ if val , ok := typeMap [DPHtlcMinimumMsat ]; ok && val == nil {
256+ dp .HtlcMinimum = fn .Some (MilliSatoshi (htlcMinScratch ))
257+ }
233258 if val , ok := typeMap [DPChannelReserveSatoshis ]; ok && val == nil {
234259 dp .ChannelReserve = fn .Some (btcutil .Amount (reserveScratch ))
235260 }
@@ -286,6 +311,14 @@ func (dp *DynPropose) SerializeTlvData() ([]byte, error) {
286311 ),
287312 )
288313 })
314+ dp .HtlcMinimum .WhenSome (func (min MilliSatoshi ) {
315+ protoSats := uint64 (min )
316+ tlvRecords = append (
317+ tlvRecords , tlv .MakePrimitiveRecord (
318+ DPHtlcMinimumMsat , & protoSats ,
319+ ),
320+ )
321+ })
289322 dp .ChannelReserve .WhenSome (func (min btcutil.Amount ) {
290323 channelReserve := uint64 (min )
291324 tlvRecords = append (
0 commit comments