mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
routerrpc: de-duplicate htlc held by interceptor
This commit ensures htlcs currently held by the interceptor Are not sent again. This prevents potential races in the user code that may lead to loosing funds.
This commit is contained in:
parent
b45c4ea7e3
commit
1f1b33bf85
1 changed files with 5 additions and 0 deletions
|
@ -150,6 +150,11 @@ func (r *forwardInterceptor) holdAndForwardToClient(
|
||||||
htlc := forward.Packet()
|
htlc := forward.Packet()
|
||||||
inKey := htlc.IncomingCircuit
|
inKey := htlc.IncomingCircuit
|
||||||
|
|
||||||
|
// ignore already held htlcs.
|
||||||
|
if _, ok := r.holdForwards[inKey]; ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// First hold the forward, then send to client.
|
// First hold the forward, then send to client.
|
||||||
r.holdForwards[inKey] = forward
|
r.holdForwards[inKey] = forward
|
||||||
interceptionRequest := &ForwardHtlcInterceptRequest{
|
interceptionRequest := &ForwardHtlcInterceptRequest{
|
||||||
|
|
Loading…
Add table
Reference in a new issue