package htlcswitch
import (
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/invoices"
"github.com/lightningnetwork/lnd/lnpeer"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
)
type InvoiceDatabase interface {
LookupInvoice(lntypes.Hash) (channeldb.Invoice, error)
NotifyExitHopHtlc(payHash lntypes.Hash, paidAmount lnwire.MilliSatoshi,
expiry uint32, currentHeight int32,
circuitKey channeldb.CircuitKey, hodlChan chan<- interface{},
payload invoices.Payload) (invoices.HtlcResolution, error)
CancelInvoice(payHash lntypes.Hash) error
SettleHodlInvoice(preimage lntypes.Preimage) error
HodlUnsubscribeAll(subscriber chan<- interface{})
}
type ChannelLink interface {
HandleSwitchPacket(*htlcPacket) error
HandleChannelUpdate(lnwire.Message)
ChannelPoint() *wire.OutPoint
ChanID() lnwire.ChannelID
ShortChanID() lnwire.ShortChannelID
UpdateShortChanID() (lnwire.ShortChannelID, error)
UpdateForwardingPolicy(ForwardingPolicy)
CheckHtlcForward(payHash [32]byte, incomingAmt lnwire.MilliSatoshi,
amtToForward lnwire.MilliSatoshi,
incomingTimeout, outgoingTimeout uint32,
heightNow uint32) *LinkError
CheckHtlcTransit(payHash [32]byte, amt lnwire.MilliSatoshi,
timeout uint32, heightNow uint32) *LinkError
Bandwidth() lnwire.MilliSatoshi
Stats() (uint64, lnwire.MilliSatoshi, lnwire.MilliSatoshi)
Peer() lnpeer.Peer
EligibleToForward() bool
AttachMailBox(MailBox)
Start() error
Stop()
}
type ForwardingLog interface {
AddForwardingEvents([]channeldb.ForwardingEvent) error
}
type TowerClient interface {
RegisterChannel(lnwire.ChannelID) error
BackupState(*lnwire.ChannelID, *lnwallet.BreachRetribution, bool) error
}
type htlcNotifier interface {
NotifyForwardingEvent(key HtlcKey, info HtlcInfo,
eventType HtlcEventType)
NotifyLinkFailEvent(key HtlcKey, info HtlcInfo,
eventType HtlcEventType, linkErr *LinkError, incoming bool)
NotifyForwardingFailEvent(key HtlcKey, eventType HtlcEventType)
NotifySettleEvent(key HtlcKey, eventType HtlcEventType)
}