lnwire: fix encoding of MilliSatoshi

`MilliSatoshi` itself is already a `BigSize`, we just need to change the
decoding and encoding types to use that.
This commit is contained in:
yyforyongyu
2025-07-02 02:47:48 +08:00
parent 5e9365552c
commit e94ca84449
2 changed files with 10 additions and 16 deletions

View File

@@ -76,8 +76,8 @@ func (dc *DynCommit) Decode(r io.Reader, _ uint32) error {
// Prepare receiving buffers to be filled by TLV extraction.
var dustLimit tlv.RecordT[tlv.TlvType0, tlv.BigSizeT[btcutil.Amount]]
var maxValue tlv.RecordT[tlv.TlvType2, uint64]
var htlcMin tlv.RecordT[tlv.TlvType4, uint64]
var maxValue tlv.RecordT[tlv.TlvType2, MilliSatoshi]
var htlcMin tlv.RecordT[tlv.TlvType4, MilliSatoshi]
var reserve tlv.RecordT[tlv.TlvType6, tlv.BigSizeT[btcutil.Amount]]
csvDelay := dc.CsvDelay.Zero()
maxHtlcs := dc.MaxAcceptedHTLCs.Zero()
@@ -100,12 +100,12 @@ func (dc *DynCommit) Decode(r io.Reader, _ uint32) error {
}
if val, ok := typeMap[dc.MaxValueInFlight.TlvType()]; ok && val == nil {
var rec tlv.RecordT[tlv.TlvType2, MilliSatoshi]
rec.Val = MilliSatoshi(maxValue.Val)
rec.Val = maxValue.Val
dc.MaxValueInFlight = tlv.SomeRecordT(rec)
}
if val, ok := typeMap[dc.HtlcMinimum.TlvType()]; ok && val == nil {
var rec tlv.RecordT[tlv.TlvType4, MilliSatoshi]
rec.Val = MilliSatoshi(htlcMin.Val)
rec.Val = htlcMin.Val
dc.HtlcMinimum = tlv.SomeRecordT(rec)
}
if val, ok := typeMap[dc.ChannelReserve.TlvType()]; ok && val == nil {