2019-04-16 11:33:30 +02:00
|
|
|
package contractcourt
|
|
|
|
|
|
|
|
import (
|
2022-11-18 12:15:22 +01:00
|
|
|
"github.com/lightningnetwork/lnd/channeldb/models"
|
2019-04-16 11:33:30 +02:00
|
|
|
"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 {
|
2019-12-20 11:25:07 +01:00
|
|
|
notifyChan chan notifyExitHopData
|
|
|
|
notifyErr error
|
2020-02-06 18:35:10 +01:00
|
|
|
notifyResolution invoices.HtlcResolution
|
2019-04-16 11:33:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *mockRegistry) NotifyExitHopHtlc(payHash lntypes.Hash,
|
|
|
|
paidAmount lnwire.MilliSatoshi, expiry uint32, currentHeight int32,
|
2022-11-18 12:15:22 +01:00
|
|
|
circuitKey models.CircuitKey, hodlChan chan<- interface{},
|
2020-02-06 18:35:10 +01:00
|
|
|
payload invoices.Payload) (invoices.HtlcResolution, error) {
|
2019-04-16 11:33:30 +02:00
|
|
|
|
|
|
|
r.notifyChan <- notifyExitHopData{
|
|
|
|
hodlChan: hodlChan,
|
|
|
|
payHash: payHash,
|
|
|
|
paidAmount: paidAmount,
|
|
|
|
expiry: expiry,
|
|
|
|
currentHeight: currentHeight,
|
|
|
|
}
|
|
|
|
|
2019-12-20 11:25:07 +01:00
|
|
|
return r.notifyResolution, r.notifyErr
|
2019-04-16 11:33:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *mockRegistry) HodlUnsubscribeAll(subscriber chan<- interface{}) {}
|
|
|
|
|
2022-11-30 12:00:37 +01:00
|
|
|
func (r *mockRegistry) LookupInvoice(lntypes.Hash) (invoices.Invoice,
|
2019-04-16 11:33:30 +02:00
|
|
|
error) {
|
|
|
|
|
2022-11-30 12:00:37 +01:00
|
|
|
return invoices.Invoice{}, invoices.ErrInvoiceNotFound
|
2019-04-16 11:33:30 +02:00
|
|
|
}
|