Skip to content

Commit 7302ea4

Browse files
committed
sphinx: switch to using BigSize for varints
1 parent 3b4e296 commit 7302ea4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

path.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/btcsuite/btcd/btcec"
1111
"github.com/btcsuite/btcd/wire"
12+
"github.com/lightningnetwork/lnd/tlv"
1213
)
1314

1415
// HopData is the information destined for individual hops. It is a fixed size
@@ -210,7 +211,8 @@ func (hp *HopPayload) Encode(w io.Writer) error {
210211
// For the TLV payload, we'll first prepend the length of the payload
211212
// as a var-int.
212213
case PayloadTLV:
213-
err := wire.WriteVarInt(w, 0, uint64(len(hp.Payload)))
214+
var b [8]byte
215+
err := tlv.WriteVarInt(w, uint64(len(hp.Payload)), &b)
214216
if err != nil {
215217
return err
216218
}
@@ -254,7 +256,8 @@ func (hp *HopPayload) Decode(r io.Reader) error {
254256
default:
255257
// Otherwise, this is the new TLV based payload type, so we'll
256258
// extract the payload length encoded as a var-int.
257-
varInt, err := wire.ReadVarInt(bufReader, 0)
259+
var b [8]byte
260+
varInt, err := tlv.ReadVarInt(bufReader, &b)
258261
if err != nil {
259262
return err
260263
}

0 commit comments

Comments
 (0)