Skip to content

Commit fc0ae94

Browse files
committed
sphinx_test: test jumbo size onion message packets
This commit adds a helper function to create onion messages of a specified length. This helper is then used to test the handling of packets larger than 1300 bytes specifically for onion messages.
1 parent e9cf493 commit fc0ae94

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sphinx_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,18 @@ func mustNewLegacyHopPayload(hopData *HopData) HopPayload {
846846
return payload
847847
}
848848

849+
// TestPaymentPathTotalPayloadSizeExceeds1300 tests that a PaymentPath can have
850+
// a TotalPayloadSize greater than 1300 bytes.
851+
func TestPaymentPathTotalPayloadSizeExceeds1300(t *testing.T) {
852+
_, route, _, err := newOnionMessageRoute(15)
853+
require.NoError(t, err, "newOnionMessageRoute should not return an "+
854+
"error")
855+
856+
totalSize := route.TotalPayloadSize()
857+
require.Greater(t, totalSize, 1300, "TotalPayloadSize should be "+
858+
"greater than 1300")
859+
}
860+
849861
// TestSphinxHopVariableSizedPayloads tests that we're able to fully decode an
850862
// EOB payload that was targeted at the final hop in a route, and also when
851863
// intermediate nodes have EOB data encoded as well. Additionally, we test that

0 commit comments

Comments
 (0)