2019-04-16 12:33:30 +03:00
|
|
|
package contractcourt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/lightningnetwork/lnd/channeldb"
|
|
|
|
"github.com/lightningnetwork/lnd/invoices"
|
|
|
|
"github.com/lightningnetwork/lnd/lntypes"
|
|
|
|
"github.com/lightningnetwork/lnd/lnwire"
|
|
|
|
)
|
|
|
|
|
|
|
|
type notifyExitHopData struct {
|
|
|
|
payHash lntypes.Hash
|
|
|
|
paidAmount lnwire.MilliSatoshi
|
|
|
|
hodlChan chan<- interface{}
|
|
|
|
expiry uint32
|
|
|
|
currentHeight int32
|
|
|
|
}
|
|
|
|
|
|
|
|
type mockRegistry struct {
|
|
|
|
notifyChan chan notifyExitHopData
|
|
|
|
notifyErr error
|
|
|
|
notifyEvent *invoices.HodlEvent
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *mockRegistry) NotifyExitHopHtlc(payHash lntypes.Hash,
|
|
|
|
paidAmount lnwire.MilliSatoshi, expiry uint32, currentHeight int32,
|
2019-07-31 07:52:17 +03:00
|
|
|
hodlChan chan<- interface{}, eob []byte) (*invoices.HodlEvent, error) {
|
2019-04-16 12:33:30 +03:00
|
|
|
|
|
|
|
r.notifyChan <- notifyExitHopData{
|
|
|
|
hodlChan: hodlChan,
|
|
|
|
payHash: payHash,
|
|
|
|
paidAmount: paidAmount,
|
|
|
|
expiry: expiry,
|
|
|
|
currentHeight: currentHeight,
|
|
|
|
}
|
|
|
|
|
|
|
|
return r.notifyEvent, r.notifyErr
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *mockRegistry) HodlUnsubscribeAll(subscriber chan<- interface{}) {}
|
|
|
|
|
|
|
|
func (r *mockRegistry) LookupInvoice(lntypes.Hash) (channeldb.Invoice, uint32,
|
|
|
|
error) {
|
|
|
|
|
|
|
|
return channeldb.Invoice{}, 0, channeldb.ErrInvoiceNotFound
|
|
|
|
}
|