Skip to content

Commit a5fcf33

Browse files
GeorgeTsagkguggero
authored andcommitted
lnrpc: add wire records fields to SendPayment & HtlcInterceptor
1 parent 25b4066 commit a5fcf33

File tree

6 files changed

+760
-668
lines changed

6 files changed

+760
-668
lines changed

itest/lnd_forward_interceptor_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ func testForwardInterceptorModifiedHtlc(ht *lntest.HarnessTest) {
410410
newOutgoingAmountMsat := packet.OutgoingAmountMsat + 4000
411411

412412
err := bobInterceptor.Send(&routerrpc.ForwardHtlcInterceptResponse{
413-
IncomingCircuitKey: packet.IncomingCircuitKey,
414-
OutgoingAmountMsat: newOutgoingAmountMsat,
415-
CustomRecords: customRecords,
416-
Action: action,
413+
IncomingCircuitKey: packet.IncomingCircuitKey,
414+
OutgoingAmountMsat: newOutgoingAmountMsat,
415+
OutgoingHtlcWireCustomRecords: customRecords,
416+
Action: action,
417417
})
418418
require.NoError(ht, err, "failed to send request")
419419

lnrpc/routerrpc/forward_interceptor.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ func (r *forwardInterceptor) onIntercept(
8484
ChanId: inKey.ChanID.ToUint64(),
8585
HtlcId: inKey.HtlcID,
8686
},
87-
OutgoingRequestedChanId: htlc.OutgoingChanID.ToUint64(),
88-
PaymentHash: htlc.Hash[:],
89-
OutgoingAmountMsat: uint64(htlc.OutgoingAmount),
90-
OutgoingExpiry: htlc.OutgoingExpiry,
91-
IncomingAmountMsat: uint64(htlc.IncomingAmount),
92-
IncomingExpiry: htlc.IncomingExpiry,
93-
CustomRecords: htlc.CustomRecords,
94-
OnionBlob: htlc.OnionBlob[:],
95-
AutoFailHeight: htlc.AutoFailHeight,
87+
OutgoingRequestedChanId: htlc.OutgoingChanID.ToUint64(),
88+
PaymentHash: htlc.Hash[:],
89+
OutgoingAmountMsat: uint64(htlc.OutgoingAmount),
90+
OutgoingExpiry: htlc.OutgoingExpiry,
91+
IncomingAmountMsat: uint64(htlc.IncomingAmount),
92+
IncomingExpiry: htlc.IncomingExpiry,
93+
CustomRecords: htlc.CustomRecords,
94+
OnionBlob: htlc.OnionBlob[:],
95+
AutoFailHeight: htlc.AutoFailHeight,
96+
IncomingHtlcWireCustomRecords: htlc.IncomingWireCustomRecords,
9697
}
9798

9899
return r.stream.Send(interceptionRequest)
@@ -138,9 +139,9 @@ func (r *forwardInterceptor) resolveFromClient(
138139
}
139140

140141
customRecords := fn.None[record.CustomSet]()
141-
if len(in.CustomRecords) > 0 {
142+
if len(in.OutgoingHtlcWireCustomRecords) > 0 {
142143
// Validate custom records.
143-
cr := record.CustomSet(in.CustomRecords)
144+
cr := record.CustomSet(in.OutgoingHtlcWireCustomRecords)
144145
if err := cr.Validate(); err != nil {
145146
return status.Errorf(
146147
codes.InvalidArgument,

0 commit comments

Comments
 (0)