htlcswitch: expose custom records on intercepted packet

This commit is contained in:
Joost Jager committed 2020-06-27 11:00:46 +02:00
1 parent 363142de33
commit 2903505164
9 files changed
+216 -165

No files matched your search

@@ -21,6 +21,11 @@ import (
"google.golang.org/grpc/status"
)
var (
customTestKey uint64 = 394829
customTestValue = []byte{1, 3, 5}
)
type interceptorTestCase struct {
amountMsat int64
invoice *lnrpc.Invoice
@@ -149,6 +154,10 @@ func testForwardInterceptor(net *lntest.NetworkHarness, t *harnessTest) {
request.IncomingAmountMsat,
)
value, ok := request.CustomRecords[customTestKey]
require.True(t.t, ok, "expected custom record")
require.Equal(t.t, customTestValue, value)
testCase := testCases[i]
// For held packets we ignore, keeping them in hold status.
@@ -369,6 +378,11 @@ func (c *interceptorTestContext) sendAliceToCarolPayment(ctx context.Context,
Route: route,
}
// Send a custom record to the forwarding node.
route.Hops[0].CustomRecords = map[uint64][]byte{
customTestKey: customTestValue,
}
// Send the payment.
return c.alice.RouterClient.SendToRouteV2(ctx, sendReq)
}