mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-12 12:52:53 +02:00
go.mod+lnwire: bump TLV dep and fix MilliSatoshi Record
In this commit, we update the `tlv` package version which includes type constraints on the `tlv.SizeBigSize` method parameter. This exposes a bug in the MilliSatoshi Record method which is fixed here. This was not caught in tests before since currently only our TLV encoding code makes use of this SizeFunc (so we would write 0 size to disk) but then when we read the bytes from disk and decode, we dont use the SizeFunc and our MilliSatoshi decode method makes direct use of the `tlv.DBigSize` function which _currently does not make use of the `l` length variable passed to it_. So it currently does correctly read the data.
This commit is contained in:
parent
8b413e89f1
commit
ad38ed73c7
@ -55,8 +55,10 @@ func (m MilliSatoshi) String() string {
|
||||
// Record returns a TLV record that can be used to encode/decode a MilliSatoshi
|
||||
// to/from a TLV stream.
|
||||
func (m *MilliSatoshi) Record() tlv.Record {
|
||||
msat := uint64(*m)
|
||||
|
||||
return tlv.MakeDynamicRecord(
|
||||
0, m, tlv.SizeBigSize(m), encodeMilliSatoshis,
|
||||
0, m, tlv.SizeBigSize(&msat), encodeMilliSatoshis,
|
||||
decodeMilliSatoshis,
|
||||
)
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -44,7 +44,7 @@ require (
|
||||
github.com/lightningnetwork/lnd/queue v1.1.1
|
||||
github.com/lightningnetwork/lnd/sqldb v1.0.9
|
||||
github.com/lightningnetwork/lnd/ticker v1.1.1
|
||||
github.com/lightningnetwork/lnd/tlv v1.3.0
|
||||
github.com/lightningnetwork/lnd/tlv v1.3.1
|
||||
github.com/lightningnetwork/lnd/tor v1.1.6
|
||||
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796
|
||||
github.com/miekg/dns v1.1.43
|
||||
|
4
go.sum
4
go.sum
@ -379,8 +379,8 @@ github.com/lightningnetwork/lnd/sqldb v1.0.9 h1:7OHi+Hui823mB/U9NzCdlZTAGSVdDCbj
|
||||
github.com/lightningnetwork/lnd/sqldb v1.0.9/go.mod h1:OG09zL/PHPaBJefp4HsPz2YLUJ+zIQHbpgCtLnOx8I4=
|
||||
github.com/lightningnetwork/lnd/ticker v1.1.1 h1:J/b6N2hibFtC7JLV77ULQp++QLtCwT6ijJlbdiZFbSM=
|
||||
github.com/lightningnetwork/lnd/ticker v1.1.1/go.mod h1:waPTRAAcwtu7Ji3+3k+u/xH5GHovTsCoSVpho0KDvdA=
|
||||
github.com/lightningnetwork/lnd/tlv v1.3.0 h1:exS/KCPEgpOgviIttfiXAPaUqw2rHQrnUOpP7HPBPiY=
|
||||
github.com/lightningnetwork/lnd/tlv v1.3.0/go.mod h1:pJuiBj1ecr1WWLOtcZ+2+hu9Ey25aJWFIsjmAoPPnmc=
|
||||
github.com/lightningnetwork/lnd/tlv v1.3.1 h1:o7CZg06y+rJZfUMAo0WzBLr0pgBWCzrt0f9gpujYUzk=
|
||||
github.com/lightningnetwork/lnd/tlv v1.3.1/go.mod h1:pJuiBj1ecr1WWLOtcZ+2+hu9Ey25aJWFIsjmAoPPnmc=
|
||||
github.com/lightningnetwork/lnd/tor v1.1.6 h1:WHUumk7WgU6BUFsqHuqszI9P6nfhMeIG+rjJBlVE6OE=
|
||||
github.com/lightningnetwork/lnd/tor v1.1.6/go.mod h1:qSRB8llhAK+a6kaTPWOLLXSZc6Hg8ZC0mq1sUQ/8JfI=
|
||||
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 h1:sjOGyegMIhvgfq5oaue6Td+hxZuf3tDC8lAPrFldqFw=
|
||||
|
@ -55,8 +55,10 @@ func (m MilliSatoshi) String() string {
|
||||
// Record returns a TLV record that can be used to encode/decode a MilliSatoshi
|
||||
// to/from a TLV stream.
|
||||
func (m *MilliSatoshi) Record() tlv.Record {
|
||||
msat := uint64(*m)
|
||||
|
||||
return tlv.MakeDynamicRecord(
|
||||
0, m, tlv.SizeBigSize(m), encodeMilliSatoshis,
|
||||
0, m, tlv.SizeBigSize(&msat), encodeMilliSatoshis,
|
||||
decodeMilliSatoshis,
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user