8154b96d67
* So far very simple, only notifications for tx confirmations, and outpoint spends. * Our two cases are: waiting for the funding transaction to reach a depth of N confirmations, and open channels being notified of the counterpart trying to cheat them by broadcasting an invalidated commitment tx.
26 lines
641 B
Go
26 lines
641 B
Go
package chainntnfs
|
|
|
|
import "github.com/btcsuite/btcd/wire"
|
|
|
|
// TODO(roasbeef): finish
|
|
// * multiple backends for interface
|
|
// * btcd - websockets
|
|
// * core - rpc polling or ZeroMQ
|
|
// * direct p2p
|
|
// * random bitcoin API?
|
|
// * electrum?
|
|
// * SPV bloomfilter
|
|
// * other stuff maybe...
|
|
type ChainNotifier interface {
|
|
RegisterConfirmationsNotification(txid *wire.ShaHash, numConfs uint32, trigger *NotificationTrigger) error
|
|
RegisterSpendNotification(outpoint *wire.OutPoint, trigger *NotificationTrigger) error
|
|
|
|
Start() error
|
|
Stop() error
|
|
}
|
|
|
|
type NotificationTrigger struct {
|
|
TriggerChan chan struct{}
|
|
Callback func()
|
|
}
|