htlcswitch: encapsulate exposed packet info

This commit is contained in:
Joost Jager
2020-06-23 16:19:41 +02:00
parent 607927634d
commit 74db43282c
3 changed files with 33 additions and 18 deletions

View File

@@ -148,18 +148,18 @@ func (r *forwardInterceptor) holdAndForwardToClient(
forward htlcswitch.InterceptedForward) error {
htlc := forward.Packet()
inKey := forward.CircuitKey()
inKey := htlc.IncomingCircuit
// First hold the forward, then send to client.
r.holdForwards[forward.CircuitKey()] = forward
r.holdForwards[inKey] = forward
interceptionRequest := &ForwardHtlcInterceptRequest{
IncomingCircuitKey: &CircuitKey{
ChanId: inKey.ChanID.ToUint64(),
HtlcId: inKey.HtlcID,
},
PaymentHash: htlc.PaymentHash[:],
OutgoingAmountMsat: uint64(htlc.Amount),
OutgoingExpiry: htlc.Expiry,
PaymentHash: htlc.Hash[:],
OutgoingAmountMsat: uint64(htlc.OutgoingAmount),
OutgoingExpiry: htlc.OutgoingExpiry,
}
return r.stream.Send(interceptionRequest)