github.com/decred/dcrlnd@v0.7.6/contractcourt/mock_registry_test.go (about) 1 package contractcourt 2 3 import ( 4 "github.com/decred/dcrlnd/channeldb" 5 "github.com/decred/dcrlnd/invoices" 6 "github.com/decred/dcrlnd/lntypes" 7 "github.com/decred/dcrlnd/lnwire" 8 ) 9 10 type notifyExitHopData struct { 11 payHash lntypes.Hash 12 paidAmount lnwire.MilliAtom 13 hodlChan chan<- interface{} 14 expiry uint32 15 currentHeight int32 16 } 17 18 type mockRegistry struct { 19 notifyChan chan notifyExitHopData 20 notifyErr error 21 notifyResolution invoices.HtlcResolution 22 } 23 24 func (r *mockRegistry) NotifyExitHopHtlc(payHash lntypes.Hash, 25 paidAmount lnwire.MilliAtom, expiry uint32, currentHeight int32, 26 circuitKey channeldb.CircuitKey, hodlChan chan<- interface{}, 27 payload invoices.Payload) (invoices.HtlcResolution, error) { 28 29 r.notifyChan <- notifyExitHopData{ 30 hodlChan: hodlChan, 31 payHash: payHash, 32 paidAmount: paidAmount, 33 expiry: expiry, 34 currentHeight: currentHeight, 35 } 36 37 return r.notifyResolution, r.notifyErr 38 } 39 40 func (r *mockRegistry) HodlUnsubscribeAll(subscriber chan<- interface{}) {} 41 42 func (r *mockRegistry) LookupInvoice(lntypes.Hash) (channeldb.Invoice, 43 error) { 44 45 return channeldb.Invoice{}, channeldb.ErrInvoiceNotFound 46 }