mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-27 23:36:15 +02:00
routing: only pack amount and cltv if populated
With the addition of blinded routes, we now need to account for the possibility that intermediate nodes payloads will not have an amount and expiry set because that information is provided by the recipient encrypted data blob. This commit updates our payload packing to only optionally include those fields.
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
fee0e05708
commit
940b491051
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -159,6 +160,20 @@ func TestAMPHop(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestNoForwardingParams tests packing of a hop payload without an amount or
|
||||
// expiry height.
|
||||
func TestNoForwardingParams(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
hop := Hop{
|
||||
EncryptedData: []byte{1, 2, 3},
|
||||
}
|
||||
|
||||
var b bytes.Buffer
|
||||
err := hop.PackHopPayload(&b, 2)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
// TestPayloadSize tests the payload size calculation that is provided by Hop
|
||||
// structs.
|
||||
func TestPayloadSize(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user