mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
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:
@@ -112,8 +112,8 @@ func (dp *DynPropose) 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 := dp.CsvDelay.Zero()
|
||||
maxHtlcs := dp.MaxAcceptedHTLCs.Zero()
|
||||
@@ -137,14 +137,14 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error {
|
||||
}
|
||||
if val, ok := typeMap[dp.MaxValueInFlight.TlvType()]; ok && val == nil {
|
||||
var rec tlv.RecordT[tlv.TlvType2, MilliSatoshi]
|
||||
rec.Val = MilliSatoshi(maxValue.Val)
|
||||
rec.Val = maxValue.Val
|
||||
dp.MaxValueInFlight = tlv.SomeRecordT(rec)
|
||||
|
||||
delete(typeMap, dp.MaxValueInFlight.TlvType())
|
||||
}
|
||||
if val, ok := typeMap[dp.HtlcMinimum.TlvType()]; ok && val == nil {
|
||||
var rec tlv.RecordT[tlv.TlvType4, MilliSatoshi]
|
||||
rec.Val = MilliSatoshi(htlcMin.Val)
|
||||
rec.Val = htlcMin.Val
|
||||
dp.HtlcMinimum = tlv.SomeRecordT(rec)
|
||||
|
||||
delete(typeMap, dp.HtlcMinimum.TlvType())
|
||||
@@ -226,18 +226,12 @@ func dynProposeRecords(dp *DynPropose) []tlv.RecordProducer {
|
||||
)
|
||||
dp.MaxValueInFlight.WhenSome(
|
||||
func(mvif tlv.RecordT[tlv.TlvType2, MilliSatoshi]) {
|
||||
rec := tlv.NewPrimitiveRecord[tlv.TlvType2](
|
||||
uint64(mvif.Val),
|
||||
)
|
||||
recordProducers = append(recordProducers, &rec)
|
||||
recordProducers = append(recordProducers, &mvif)
|
||||
},
|
||||
)
|
||||
dp.HtlcMinimum.WhenSome(
|
||||
func(hm tlv.RecordT[tlv.TlvType4, MilliSatoshi]) {
|
||||
rec := tlv.NewPrimitiveRecord[tlv.TlvType4](
|
||||
uint64(hm.Val),
|
||||
)
|
||||
recordProducers = append(recordProducers, &rec)
|
||||
recordProducers = append(recordProducers, &hm)
|
||||
},
|
||||
)
|
||||
dp.ChannelReserve.WhenSome(
|
||||
|
Reference in New Issue
Block a user