htlcswitch: encapsulate exposed packet info

This commit is contained in:
Joost Jager committed 2020-06-27 10:59:08 +02:00
1 parent 607927634d
commit 74db43282c
3 files changed
+33 -18

No files matched your search

+19 -4
View File
@@ -200,17 +200,32 @@ type InterceptableHtlcForwarder interface {
// and resolve it later or let the switch execute its default behavior.
type ForwardInterceptor func(InterceptedForward) bool
// InterceptedPacket contains the relevant information for the interceptor about
// an htlc.
type InterceptedPacket struct {
// IncomingCircuit contains the incoming channel and htlc id of the
// packet.
IncomingCircuit channeldb.CircuitKey
// Hash is the payment hash of the htlc.
Hash lntypes.Hash
// OutgoingExpiry is the absolute block height at which the outgoing
// htlc expires.
OutgoingExpiry uint32
// OutgoingAmount is the amount to forward.
OutgoingAmount lnwire.MilliSatoshi
}
// InterceptedForward is passed to the ForwardInterceptor for every forwarded
// htlc. It contains all the information about the packet which accordingly
// the interceptor decides if to hold or not.
// In addition this interface allows a later resolution by calling either
// Resume, Settle or Fail.
type InterceptedForward interface {
// CircuitKey returns the intercepted packet.
CircuitKey() channeldb.CircuitKey
// Packet returns the intercepted packet.
Packet() lnwire.UpdateAddHTLC
Packet() InterceptedPacket
// Resume notifies the intention to resume an existing hold forward. This
// basically means the caller wants to resume with the default behavior for