From 5cea874709dd4cc64aebdb6205358ac5d6b2f5d5 Mon Sep 17 00:00:00 2001 From: ffranr Date: Wed, 2 Jul 2025 16:28:44 +0100 Subject: [PATCH] chainntnfs: export NotifierOptions and internal field for interface use Export NotifierOptions and its internal field to enable external satisfaction of the protofsm.DaemonAdapters interface. --- chainntnfs/interface.go | 22 +++++++++++----------- chainntnfs/txnotifier.go | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/chainntnfs/interface.go b/chainntnfs/interface.go index 1b8a5acb5..798a2f427 100644 --- a/chainntnfs/interface.go +++ b/chainntnfs/interface.go @@ -70,28 +70,28 @@ func (t TxConfStatus) String() string { } } -// notifierOptions is a set of functional options that allow callers to further +// NotifierOptions is a set of functional options that allow callers to further // modify the type of chain event notifications they receive. -type notifierOptions struct { - // includeBlock if true, then the dispatched confirmation notification +type NotifierOptions struct { + // IncludeBlock if true, then the dispatched confirmation notification // will include the block that mined the transaction. - includeBlock bool + IncludeBlock bool } -// defaultNotifierOptions returns the set of default options for the notifier. -func defaultNotifierOptions() *notifierOptions { - return ¬ifierOptions{} +// DefaultNotifierOptions returns the set of default options for the notifier. +func DefaultNotifierOptions() *NotifierOptions { + return &NotifierOptions{} } // NotifierOption is a functional option that allows a caller to modify the // events received from the notifier. -type NotifierOption func(*notifierOptions) +type NotifierOption func(*NotifierOptions) -// WithIncludeBlock is an optional argument that allows the calelr to specify +// WithIncludeBlock is an optional argument that allows the caller to specify // that the block that mined a transaction should be included in the response. func WithIncludeBlock() NotifierOption { - return func(o *notifierOptions) { - o.includeBlock = true + return func(o *NotifierOptions) { + o.IncludeBlock = true } } diff --git a/chainntnfs/txnotifier.go b/chainntnfs/txnotifier.go index 12366abf9..8b5b8dc8b 100644 --- a/chainntnfs/txnotifier.go +++ b/chainntnfs/txnotifier.go @@ -559,7 +559,7 @@ func NewTxNotifier(startHeight uint32, reorgSafetyLimit uint32, // and register a confirmation notification. func (n *TxNotifier) newConfNtfn(txid *chainhash.Hash, pkScript []byte, numConfs, heightHint uint32, - opts *notifierOptions) (*ConfNtfn, error) { + opts *NotifierOptions) (*ConfNtfn, error) { // An accompanying output script must always be provided. if len(pkScript) == 0 { @@ -593,7 +593,7 @@ func (n *TxNotifier) newConfNtfn(txid *chainhash.Hash, n.CancelConf(confRequest, confID) }), HeightHint: heightHint, - includeBlock: opts.includeBlock, + includeBlock: opts.IncludeBlock, numConfsLeft: numConfs, }, nil } @@ -616,7 +616,7 @@ func (n *TxNotifier) RegisterConf(txid *chainhash.Hash, pkScript []byte, default: } - opts := defaultNotifierOptions() + opts := DefaultNotifierOptions() for _, optFunc := range optFuncs { optFunc(opts) }