chainntnfs: update RegisterConfirmationsNtfn to also pass in pkScript of output

In this commit, we prep for an upcoming final change to BIP 158. The
change results in the txid no longer being included in the regular
filter. As a result, neutrino will now need to match based on the output
script of the transaction that we wish to receive confirmation
notifications for.
This commit is contained in:
Olaoluwa Osuntokun committed 2018-07-31 21:13:43 -07:00
1 parent ad7f87ef18
commit 0f98030186
1 file changed
+12 -10
+12 -10
View File
@@ -20,19 +20,21 @@ import (
// resource // resource
type ChainNotifier interface { type ChainNotifier interface {
// RegisterConfirmationsNtfn registers an intent to be notified once // RegisterConfirmationsNtfn registers an intent to be notified once
// txid reaches numConfs confirmations. The returned ConfirmationEvent // txid reaches numConfs confirmations. We also pass in the pkScript as
// should properly notify the client once the specified number of // the default light client instead needs to match on scripts created
// confirmations has been reached for the txid, as well as if the // in the block. The returned ConfirmationEvent should properly notify
// original tx gets re-org'd out of the mainchain. The heightHint // the client once the specified number of confirmations has been
// parameter is provided as a convenience to light clients. The // reached for the txid, as well as if the original tx gets re-org'd
// heightHint denotes the earliest height in the blockchain in which the // out of the mainchain. The heightHint parameter is provided as a
// target txid _could_ have been included in the chain. This can be // convenience to light clients. The heightHint denotes the earliest
// used to bound the search space when checking to see if a // height in the blockchain in which the target txid _could_ have been
// notification can immediately be dispatched due to historical data. // included in the chain. This can be used to bound the search space
// when checking to see if a notification can immediately be dispatched
// due to historical data.
// //
// NOTE: Dispatching notifications to multiple clients subscribed to // NOTE: Dispatching notifications to multiple clients subscribed to
// the same (txid, numConfs) tuple MUST be supported. // the same (txid, numConfs) tuple MUST be supported.
RegisterConfirmationsNtfn(txid *chainhash.Hash, numConfs, RegisterConfirmationsNtfn(txid *chainhash.Hash, pkScript []byte, numConfs,
heightHint uint32) (*ConfirmationEvent, error) heightHint uint32) (*ConfirmationEvent, error)
// RegisterSpendNtfn registers an intent to be notified once the target // RegisterSpendNtfn registers an intent to be notified once the target