2019-04-16 11:21:02 +03:00
|
|
|
package contractcourt
|
|
|
|
|
|
|
|
import (
|
2019-08-26 15:06:57 +03:00
|
|
|
"io"
|
|
|
|
|
2019-10-31 14:42:49 +03:00
|
|
|
"github.com/btcsuite/btcd/wire"
|
2019-04-16 11:21:02 +03:00
|
|
|
"github.com/lightningnetwork/lnd/channeldb"
|
2019-08-26 15:06:57 +03:00
|
|
|
"github.com/lightningnetwork/lnd/htlcswitch/hop"
|
2019-10-31 14:42:49 +03:00
|
|
|
"github.com/lightningnetwork/lnd/input"
|
2019-04-16 11:21:02 +03:00
|
|
|
"github.com/lightningnetwork/lnd/invoices"
|
|
|
|
"github.com/lightningnetwork/lnd/lntypes"
|
|
|
|
"github.com/lightningnetwork/lnd/lnwire"
|
2019-10-31 14:42:49 +03:00
|
|
|
"github.com/lightningnetwork/lnd/sweep"
|
2019-04-16 11:21:02 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Registry is an interface which represents the invoice registry.
|
|
|
|
type Registry interface {
|
|
|
|
// LookupInvoice attempts to look up an invoice according to its 32
|
2019-08-20 15:54:39 +03:00
|
|
|
// byte payment hash.
|
|
|
|
LookupInvoice(lntypes.Hash) (channeldb.Invoice, error)
|
2019-04-16 11:21:02 +03:00
|
|
|
|
|
|
|
// NotifyExitHopHtlc attempts to mark an invoice as settled. If the
|
|
|
|
// invoice is a debug invoice, then this method is a noop as debug
|
|
|
|
// invoices are never fully settled. The return value describes how the
|
|
|
|
// htlc should be resolved. If the htlc cannot be resolved immediately,
|
|
|
|
// the resolution is sent on the passed in hodlChan later.
|
|
|
|
NotifyExitHopHtlc(payHash lntypes.Hash, paidAmount lnwire.MilliSatoshi,
|
2019-04-16 13:11:20 +03:00
|
|
|
expiry uint32, currentHeight int32,
|
2019-08-08 16:48:31 +03:00
|
|
|
circuitKey channeldb.CircuitKey, hodlChan chan<- interface{},
|
2019-11-05 02:10:32 +03:00
|
|
|
payload invoices.Payload) (*invoices.HodlEvent, error)
|
2019-04-16 11:21:02 +03:00
|
|
|
|
|
|
|
// HodlUnsubscribeAll unsubscribes from all hodl events.
|
|
|
|
HodlUnsubscribeAll(subscriber chan<- interface{})
|
|
|
|
}
|
2019-08-26 15:06:57 +03:00
|
|
|
|
|
|
|
// OnionProcessor is an interface used to decode onion blobs.
|
|
|
|
type OnionProcessor interface {
|
|
|
|
// ReconstructHopIterator attempts to decode a valid sphinx packet from
|
|
|
|
// the passed io.Reader instance.
|
|
|
|
ReconstructHopIterator(r io.Reader, rHash []byte) (hop.Iterator, error)
|
|
|
|
}
|
2019-10-31 14:42:49 +03:00
|
|
|
|
|
|
|
// UtxoSweeper defines the sweep functions that contract court requires.
|
|
|
|
type UtxoSweeper interface {
|
|
|
|
// SweepInput sweeps inputs back into the wallet.
|
|
|
|
SweepInput(input input.Input,
|
|
|
|
feePreference sweep.FeePreference) (chan sweep.Result, error)
|
|
|
|
|
|
|
|
// CreateSweepTx accepts a list of inputs and signs and generates a txn
|
|
|
|
// that spends from them. This method also makes an accurate fee
|
|
|
|
// estimate before generating the required witnesses.
|
|
|
|
CreateSweepTx(inputs []input.Input, feePref sweep.FeePreference,
|
|
|
|
currentBlockHeight uint32) (*wire.MsgTx, error)
|
|
|
|
}
|