From 7a0b7d2742d0aebf81a0a673798954136fc4bedd Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 17 Jul 2018 18:47:01 -0700 Subject: [PATCH] chainntnfs: update RegisterSpendNtfn to take the prev output script In this commit, we update the RegisterSpendNtfn method to also take the prev output script of the item that we're attempting to watch for. This change is required due to the recent modifications in the neutrino protocol (BIP 158 + 157). With the new protocol, we'll match on the script, but then dispatch notifications based on the precise outpoint that matches. --- chainntnfs/interface.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chainntnfs/interface.go b/chainntnfs/interface.go index 37c370e47..053e7ed3f 100644 --- a/chainntnfs/interface.go +++ b/chainntnfs/interface.go @@ -38,7 +38,9 @@ type ChainNotifier interface { heightHint uint32) (*ConfirmationEvent, error) // RegisterSpendNtfn registers an intent to be notified once the target - // outpoint is successfully spent within a transaction. The returned + // outpoint is successfully spent within a transaction. The script that + // the outpoint creates must also be specified. This allows this + // interface to be implemented by BIP 158-like filtering. The returned // SpendEvent will receive a send on the 'Spend' transaction once a // transaction spending the input is detected on the blockchain. The // heightHint parameter is provided as a convenience to light clients. @@ -50,8 +52,8 @@ type ChainNotifier interface { // // NOTE: Dispatching notifications to multiple clients subscribed to a // spend of the same outpoint MUST be supported. - RegisterSpendNtfn(outpoint *wire.OutPoint, - heightHint uint32) (*SpendEvent, error) + RegisterSpendNtfn(outpoint *wire.OutPoint, pkScript []byte, + heightHint uint32, mempool bool) (*SpendEvent, error) // RegisterBlockEpochNtfn registers an intent to be notified of each // new block connected to the tip of the main chain. The returned