htlcswitch: expose custom records on intercepted packet
This commit is contained in:
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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user