@@ -18,6 +18,10 @@ const (
18
18
// record for DynPropose.MaxValueInFlight.
19
19
DPMaxHtlcValueInFlightMsat tlv.Type = 1
20
20
21
+ // DPHtlcMinimumMsat is the TLV type number that identifies the record
22
+ // for DynPropose.HtlcMinimum.
23
+ DPHtlcMinimumMsat tlv.Type = 7
24
+
21
25
// DPChannelReserveSatoshis is the TLV type number that identifies the
22
26
// for DynPropose.ChannelReserve.
23
27
DPChannelReserveSatoshis tlv.Type = 2
@@ -50,6 +54,10 @@ type DynPropose struct {
50
54
// max_htlc_value_in_flight_msat limit of the sender.
51
55
MaxValueInFlight fn.Option [MilliSatoshi ]
52
56
57
+ // HtlcMinimum, if not nil, proposes a change to the htlc_minimum_msat
58
+ // floor of the sender.
59
+ HtlcMinimum fn.Option [MilliSatoshi ]
60
+
53
61
// ChannelReserve, if not nil, proposes a change to the
54
62
// channel_reserve_satoshis requirement of the recipient.
55
63
ChannelReserve fn.Option [btcutil.Amount ]
@@ -106,6 +114,14 @@ func (dp *DynPropose) Encode(w *bytes.Buffer, _ uint32) error {
106
114
),
107
115
)
108
116
})
117
+ dp .HtlcMinimum .WhenSome (func (min MilliSatoshi ) {
118
+ protoSats := uint64 (min )
119
+ tlvRecords = append (
120
+ tlvRecords , tlv .MakePrimitiveRecord (
121
+ DPHtlcMinimumMsat , & protoSats ,
122
+ ),
123
+ )
124
+ })
109
125
dp .ChannelReserve .WhenSome (func (min btcutil.Amount ) {
110
126
channelReserve := uint64 (min )
111
127
tlvRecords = append (
@@ -185,6 +201,11 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error {
185
201
DPMaxHtlcValueInFlightMsat , & maxValueScratch ,
186
202
)
187
203
204
+ var htlcMinScratch uint64
205
+ htlcMin := tlv .MakePrimitiveRecord (
206
+ DPHtlcMinimumMsat , & htlcMinScratch ,
207
+ )
208
+
188
209
var reserveScratch uint64
189
210
reserve := tlv .MakePrimitiveRecord (
190
211
DPChannelReserveSatoshis , & reserveScratch ,
@@ -206,7 +227,8 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error {
206
227
207
228
// Create set of Records to read TLV bytestream into.
208
229
records := []tlv.Record {
209
- dustLimit , maxValue , reserve , csvDelay , maxHtlcs , chanType ,
230
+ dustLimit , maxValue , htlcMin , reserve , csvDelay , maxHtlcs ,
231
+ chanType ,
210
232
}
211
233
tlv .SortRecords (records )
212
234
@@ -230,6 +252,9 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error {
230
252
if val , ok := typeMap [DPMaxHtlcValueInFlightMsat ]; ok && val == nil {
231
253
dp .MaxValueInFlight = fn .Some (MilliSatoshi (maxValueScratch ))
232
254
}
255
+ if val , ok := typeMap [DPHtlcMinimumMsat ]; ok && val == nil {
256
+ dp .HtlcMinimum = fn .Some (MilliSatoshi (htlcMinScratch ))
257
+ }
233
258
if val , ok := typeMap [DPChannelReserveSatoshis ]; ok && val == nil {
234
259
dp .ChannelReserve = fn .Some (btcutil .Amount (reserveScratch ))
235
260
}
@@ -286,6 +311,14 @@ func (dp *DynPropose) SerializeTlvData() ([]byte, error) {
286
311
),
287
312
)
288
313
})
314
+ dp .HtlcMinimum .WhenSome (func (min MilliSatoshi ) {
315
+ protoSats := uint64 (min )
316
+ tlvRecords = append (
317
+ tlvRecords , tlv .MakePrimitiveRecord (
318
+ DPHtlcMinimumMsat , & protoSats ,
319
+ ),
320
+ )
321
+ })
289
322
dp .ChannelReserve .WhenSome (func (min btcutil.Amount ) {
290
323
channelReserve := uint64 (min )
291
324
tlvRecords = append (
0 commit comments