routerrpc+htlcswitch: move intercepted htlc tracking to switch

In this commit we move the tracking of the outstanding intercepted htlcs
to InterceptableSwitch. This is a preparation for making the htlc
interceptor required.

Required interception involves tracking outstanding htlcs across
multiple grpc client sessions. The per-session routerrpc
forwardInterceptor object is therefore no longer the best place for
that.
This commit is contained in:
Joost Jager committed 2022-03-15 08:44:57 +01:00
1 parent 95c270d1f8
commit 169f0c0bf4
6 files changed
+379 -207

No files matched your search

+4 -1
View File
@@ -234,6 +234,9 @@ type TowerClient interface {
type InterceptableHtlcForwarder interface {
// SetInterceptor sets a ForwardInterceptor.
SetInterceptor(interceptor ForwardInterceptor)
// Resolve resolves an intercepted packet.
Resolve(res *FwdResolution) error
}
// ForwardInterceptor is a function that is invoked from the switch for every
@@ -242,7 +245,7 @@ type InterceptableHtlcForwarder interface {
// to resolve it manually later in case it is held.
// The return value indicates if this handler will take control of this forward
// and resolve it later or let the switch execute its default behavior.
type ForwardInterceptor func(InterceptedForward) bool
type ForwardInterceptor func(InterceptedPacket) error
// InterceptedPacket contains the relevant information for the interceptor about
// an htlc.