mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-26 22:56:42 +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:
@@ -176,6 +176,7 @@ func initSwitchWithDB(startingHeight uint32, db *channeldb.DB) (*Switch, error)
|
||||
FwdEventTicker: ticker.NewForce(DefaultFwdEventInterval),
|
||||
LogEventTicker: ticker.NewForce(DefaultLogInterval),
|
||||
AckEventTicker: ticker.NewForce(DefaultAckInterval),
|
||||
HtlcNotifier: &mockHTLCNotifier{},
|
||||
}
|
||||
|
||||
return New(cfg, startingHeight)
|
||||
@@ -1009,3 +1010,22 @@ func (m *mockOnionErrorDecryptor) DecryptError(encryptedData []byte) (
|
||||
Message: m.message,
|
||||
}, m.err
|
||||
}
|
||||
|
||||
var _ htlcNotifier = (*mockHTLCNotifier)(nil)
|
||||
|
||||
type mockHTLCNotifier struct{}
|
||||
|
||||
func (h *mockHTLCNotifier) NotifyForwardingEvent(key HtlcKey, info HtlcInfo,
|
||||
eventType HtlcEventType) {
|
||||
}
|
||||
|
||||
func (h *mockHTLCNotifier) NotifyLinkFailEvent(key HtlcKey, info HtlcInfo,
|
||||
eventType HtlcEventType, linkErr *LinkError, incoming bool) {
|
||||
}
|
||||
|
||||
func (h *mockHTLCNotifier) NotifyForwardingFailEvent(key HtlcKey,
|
||||
eventType HtlcEventType) {
|
||||
}
|
||||
|
||||
func (h *mockHTLCNotifier) NotifySettleEvent(key HtlcKey, eventType HtlcEventType) {
|
||||
}
|
||||
|
Reference in New Issue
Block a user