From 8154b96d677838e75db7c68b03214cf70452b274 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun <laolu32@gmail.com> Date: Wed, 6 Jan 2016 13:01:50 -0800 Subject: [PATCH] chainntfs: flesh out initial draft of interface * 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. --- chainntfs/chainntfs.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chainntfs/chainntfs.go b/chainntfs/chainntfs.go index 2f7a096f..bc06445a 100644 --- a/chainntfs/chainntfs.go +++ b/chainntfs/chainntfs.go @@ -1,5 +1,7 @@ package chainntnfs +import "github.com/btcsuite/btcd/wire" + // TODO(roasbeef): finish // * multiple backends for interface // * btcd - websockets @@ -10,4 +12,14 @@ package chainntnfs // * 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() }