mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 09:47:20 +02:00
multi: add htlcNotifier interface to switch and link
In this commit, a htlcNotifier interface is added to allow for easy unit testing. Instances of the HtlcNotifier are added to the server, switch and link.
This commit is contained in:
@@ -180,3 +180,29 @@ type TowerClient interface {
|
||||
// isTweakless should be true.
|
||||
BackupState(*lnwire.ChannelID, *lnwallet.BreachRetribution, bool) error
|
||||
}
|
||||
|
||||
// htlcNotifier is an interface which represents the input side of the
|
||||
// HtlcNotifier which htlc events are piped through. This interface is intended
|
||||
// to allow for mocking of the htlcNotifier in tests, so is unexported because
|
||||
// it is not needed outside of the htlcSwitch package.
|
||||
type htlcNotifier interface {
|
||||
// NotifyForwardingEvent notifies the HtlcNotifier than a htlc has been
|
||||
// forwarded.
|
||||
NotifyForwardingEvent(key HtlcKey, info HtlcInfo,
|
||||
eventType HtlcEventType)
|
||||
|
||||
// NotifyIncomingLinkFailEvent notifies that a htlc has failed on our
|
||||
// incoming link. It takes an isReceive bool to differentiate between
|
||||
// our node's receives and forwards.
|
||||
NotifyLinkFailEvent(key HtlcKey, info HtlcInfo,
|
||||
eventType HtlcEventType, linkErr *LinkError, incoming bool)
|
||||
|
||||
// NotifyForwardingFailEvent notifies the HtlcNotifier that a htlc we
|
||||
// forwarded has failed down the line.
|
||||
NotifyForwardingFailEvent(key HtlcKey, eventType HtlcEventType)
|
||||
|
||||
// NotifySettleEvent notifies the HtlcNotifier that a htlc that we
|
||||
// committed to as part of a forward or a receive to our node has been
|
||||
// settled.
|
||||
NotifySettleEvent(key HtlcKey, eventType HtlcEventType)
|
||||
}
|
||||
|
Reference in New Issue
Block a user