record/routing: set minimum padding size

This commit is contained in:
Elle Mouton committed 2024-07-26 10:32:47 +02:00
1 parent 398623bde5
commit 60a856ab65
4 files changed
+34 -7

No files matched your search

+7
View File
@@ -10,6 +10,13 @@ import (
"github.com/lightningnetwork/lnd/tlv"
)
// AverageDummyHopPayloadSize is the size of a standard blinded path dummy hop
// payload. In most cases, this is larger than the other payload types and so
// to make sure that a sender cannot use this fact to know if a dummy hop is
// present or not, we'll make sure to always pad all payloads to at least this
// size.
const AverageDummyHopPayloadSize = 51
// BlindedRouteData contains the information that is included in a blinded
// route encrypted data blob that is created by the recipient to provide
// forwarding information.
+4
View File
@@ -196,6 +196,10 @@ func TestDummyHopBlindedDataEncoding(t *testing.T) {
encoded, err := EncodeBlindedRouteData(routeData)
require.NoError(t, err)
// Assert the size of an average dummy hop payload in case we need to
// update this constant in future.
require.Len(t, encoded, AverageDummyHopPayloadSize)
b := bytes.NewBuffer(encoded)
decodedData, err := DecodeBlindedRouteData(b)
require.NoError(t, err)