Documentation ¶
Index ¶
- Constants
- func UseLogger(logger btclog.Logger)
- type Config
- type Watcher
- func (w *Watcher) CancelAccountConf(traderKey *btcec.PublicKey)
- func (w *Watcher) CancelAccountSpend(traderKey *btcec.PublicKey)
- func (w *Watcher) Start() error
- func (w *Watcher) Stop()
- func (w *Watcher) WatchAccountConf(traderKey *btcec.PublicKey, txHash chainhash.Hash, script []byte, ...) error
- func (w *Watcher) WatchAccountExpiration(traderKey *btcec.PublicKey, expiry uint32) error
- func (w *Watcher) WatchAccountSpend(traderKey *btcec.PublicKey, accountPoint wire.OutPoint, script []byte, ...) error
Constants ¶
const Subsystem = "WCHR"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // ChainNotifier is responsible for requesting confirmation and spend // notifications for accounts. ChainNotifier lndclient.ChainNotifierClient // HandleAccountConf abstracts the operations that should be performed // for an account once we detect its confirmation. The account is // identified by its user sub key (i.e., trader key). HandleAccountConf func(*btcec.PublicKey, *chainntnfs.TxConfirmation) error // HandleAccountSpend abstracts the operations that should be performed // for an account once we detect its spend. The account is identified by // its user sub key (i.e., trader key). HandleAccountSpend func(*btcec.PublicKey, *chainntnfs.SpendDetail) error // HandleAccountExpiry the operations that should be perform for an // account once it's expired. The account is identified by its user sub // key (i.e., trader key). HandleAccountExpiry func(*btcec.PublicKey, uint32) error }
Config contains all of the Watcher's dependencies in order to carry out its duties.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is responsible for the on-chain interaction of an account, whether that is confirmation or spend.
func (*Watcher) CancelAccountConf ¶
CancelAccountConf cancels the conf watcher of the given account, if one is active.
func (*Watcher) CancelAccountSpend ¶
CancelAccountSpend cancels the spend watcher of the given account, if one is active.
func (*Watcher) Stop ¶
func (w *Watcher) Stop()
Stop safely stops any ongoing requests within the Watcher.
func (*Watcher) WatchAccountConf ¶
func (w *Watcher) WatchAccountConf(traderKey *btcec.PublicKey, txHash chainhash.Hash, script []byte, numConfs, heightHint uint32) error
WatchAccountConf watches a new account on-chain for its confirmation. Only one conf watcher per account can be used at any time.
NOTE: If there is a previous conf watcher for the given account that has not finished yet, it will be canceled!
func (*Watcher) WatchAccountExpiration ¶
WatchAccountExpiration watches for the expiration of an account on-chain. Successive calls for the same account will cancel any previous expiration watch requests and the new expiration will be tracked instead.
func (*Watcher) WatchAccountSpend ¶
func (w *Watcher) WatchAccountSpend(traderKey *btcec.PublicKey, accountPoint wire.OutPoint, script []byte, heightHint uint32) error
WatchAccountSpend watches for the spend of an account. Only one spend watcher per account can be used at any time.
NOTE: If there is a previous spend watcher for the given account that has not finished yet, it will be canceled!