@@ -13,36 +13,36 @@ import (
1313 "google.golang.org/grpc"
1414)
1515
16- // notifierOptions is a set of functional options that allow callers to further
16+ // NotifierOptions is a set of functional options that allow callers to further
1717// modify the type of chain even notifications they receive.
18- type notifierOptions struct {
19- // includeBlock if true, then the dispatched confirmation notification
18+ type NotifierOptions struct {
19+ // IncludeBlock if true, then the dispatched confirmation notification
2020 // will include the block that mined the transaction.
21- includeBlock bool
21+ IncludeBlock bool
2222
23- // reOrgChan if set, will be sent on if the transaction is re-organized
23+ // ReOrgChan if set, will be sent on if the transaction is re-organized
2424 // out of the chain. This channel being set will also imply that we
2525 // don't cancel the notification listener after having received one
2626 // confirmation event. That means the caller manually needs to cancel
2727 // the passed in context to cancel being notified once the required
2828 // number of confirmations have been reached.
29- reOrgChan chan struct {}
29+ ReOrgChan chan struct {}
3030}
3131
3232// defaultNotifierOptions returns the set of default options for the notifier.
33- func defaultNotifierOptions () * notifierOptions {
34- return & notifierOptions {}
33+ func DefaultNotifierOptions () * NotifierOptions {
34+ return & NotifierOptions {}
3535}
3636
3737// NotifierOption is a functional option that allows a caller to modify the
3838// events received from the notifier.
39- type NotifierOption func (* notifierOptions )
39+ type NotifierOption func (* NotifierOptions )
4040
4141// WithIncludeBlock is an optional argument that allows the caller to specify
4242// that the block that mined a transaction should be included in the response.
4343func WithIncludeBlock () NotifierOption {
44- return func (o * notifierOptions ) {
45- o .includeBlock = true
44+ return func (o * NotifierOptions ) {
45+ o .IncludeBlock = true
4646 }
4747}
4848
@@ -53,8 +53,8 @@ func WithIncludeBlock() NotifierOption {
5353// to cancel being notified once the required number of confirmations have been
5454// reached.
5555func WithReOrgChan (reOrgChan chan struct {}) NotifierOption {
56- return func (o * notifierOptions ) {
57- o .reOrgChan = reOrgChan
56+ return func (o * NotifierOptions ) {
57+ o .ReOrgChan = reOrgChan
5858 }
5959}
6060
@@ -191,7 +191,7 @@ func (s *chainNotifierClient) RegisterConfirmationsNtfn(ctx context.Context,
191191 optFuncs ... NotifierOption ) (chan * chainntnfs.TxConfirmation ,
192192 chan error , error ) {
193193
194- opts := defaultNotifierOptions ()
194+ opts := DefaultNotifierOptions ()
195195 for _ , optFunc := range optFuncs {
196196 optFunc (opts )
197197 }
@@ -206,7 +206,7 @@ func (s *chainNotifierClient) RegisterConfirmationsNtfn(ctx context.Context,
206206 NumConfs : uint32 (numConfs ),
207207 HeightHint : uint32 (heightHint ),
208208 Txid : txidSlice ,
209- IncludeBlock : opts .includeBlock ,
209+ IncludeBlock : opts .IncludeBlock ,
210210 },
211211 )
212212 if err != nil {
@@ -238,7 +238,7 @@ func (s *chainNotifierClient) RegisterConfirmationsNtfn(ctx context.Context,
238238 }
239239
240240 var block * wire.MsgBlock
241- if opts .includeBlock {
241+ if opts .IncludeBlock {
242242 block , err = decodeBlock (
243243 c .Conf .RawBlock ,
244244 )
@@ -268,17 +268,17 @@ func (s *chainNotifierClient) RegisterConfirmationsNtfn(ctx context.Context,
268268 // we don't return here, since we might want to
269269 // be informed about the new block we got
270270 // confirmed in after a re-org.
271- if opts .reOrgChan == nil {
271+ if opts .ReOrgChan == nil {
272272 return
273273 }
274274
275275 // On a re-org, we just need to signal, we don't have
276276 // any additional information. But we only signal if the
277277 // caller requested to be notified about re-orgs.
278278 case * chainrpc.ConfEvent_Reorg :
279- if opts .reOrgChan != nil {
279+ if opts .ReOrgChan != nil {
280280 select {
281- case opts .reOrgChan <- struct {}{}:
281+ case opts .ReOrgChan <- struct {}{}:
282282 case <- ctx .Done ():
283283 return
284284 }
0 commit comments