chainntnfs/txnotifier: rename Register -> RegisterConf
This commit is contained in:
parent
82f6fd7a91
commit
f65401b439
@ -963,7 +963,7 @@ func (b *BitcoindNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
|
||||
// for `dispatch` will be returned if we are required to perform a
|
||||
// manual scan for the confirmation. Otherwise the notifier will begin
|
||||
// watching at tip for the transaction to confirm.
|
||||
dispatch, err := b.txNotifier.Register(ntfn)
|
||||
dispatch, err := b.txNotifier.RegisterConf(ntfn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ func (b *BtcdNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, _ []byte,
|
||||
// for `dispatch` will be returned if we are required to perform a
|
||||
// manual scan for the confirmation. Otherwise the notifier will begin
|
||||
// watching at tip for the transaction to confirm.
|
||||
dispatch, err := b.txNotifier.Register(ntfn)
|
||||
dispatch, err := b.txNotifier.RegisterConf(ntfn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -932,7 +932,7 @@ func (n *NeutrinoNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
|
||||
// for `dispatch` will be returned if we are required to perform a
|
||||
// manual scan for the confirmation. Otherwise the notifier will begin
|
||||
// watching at tip for the transaction to confirm.
|
||||
dispatch, err := n.txNotifier.Register(ntfn)
|
||||
dispatch, err := n.txNotifier.RegisterConf(ntfn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -192,19 +192,18 @@ func NewTxNotifier(startHeight uint32, reorgSafetyLimit uint32,
|
||||
}
|
||||
}
|
||||
|
||||
// Register handles a new notification request. The client will be notified when
|
||||
// the transaction gets a sufficient number of confirmations on the blockchain.
|
||||
// The registration succeeds if no error is returned. If the returned
|
||||
// HistoricalConfDispatch is non-nil, the caller is responsible for attempting
|
||||
// to manually rescan blocks for the txid between the start and end heights.
|
||||
// RegisterConf handles a new notification request. The client will be notified
|
||||
// when the transaction gets a sufficient number of confirmations on the
|
||||
// blockchain. The registration succeeds if no error is returned. If the
|
||||
// returned HistoricalConfDispatch is non-nil, the caller is responsible for
|
||||
// attempting to manually rescan blocks for the txid between the start and end
|
||||
// heights.
|
||||
//
|
||||
// NOTE: If the transaction has already been included in a block on the chain,
|
||||
// the confirmation details must be provided with the UpdateConfDetails method,
|
||||
// otherwise we will wait for the transaction to confirm even though it already
|
||||
// has.
|
||||
func (n *TxNotifier) Register(
|
||||
ntfn *ConfNtfn) (*HistoricalConfDispatch, error) {
|
||||
|
||||
func (n *TxNotifier) RegisterConf(ntfn *ConfNtfn) (*HistoricalConfDispatch, error) {
|
||||
select {
|
||||
case <-n.quit:
|
||||
return nil, ErrTxNotifierExiting
|
||||
|
@ -124,7 +124,7 @@ func TestTxConfFutureDispatch(t *testing.T) {
|
||||
NumConfirmations: tx1NumConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(tx1NumConfs),
|
||||
}
|
||||
if _, err := n.Register(&ntfn1); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn1); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ func TestTxConfFutureDispatch(t *testing.T) {
|
||||
NumConfirmations: tx2NumConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(tx2NumConfs),
|
||||
}
|
||||
if _, err := n.Register(&ntfn2); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn2); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ func TestTxConfHistoricalDispatch(t *testing.T) {
|
||||
NumConfirmations: tx1NumConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(tx1NumConfs),
|
||||
}
|
||||
if _, err := n.Register(&ntfn1); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn1); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ func TestTxConfHistoricalDispatch(t *testing.T) {
|
||||
NumConfirmations: tx2NumConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(tx2NumConfs),
|
||||
}
|
||||
if _, err := n.Register(&ntfn2); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn2); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ func TestTxConfChainReorg(t *testing.T) {
|
||||
NumConfirmations: tx1NumConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(tx1NumConfs),
|
||||
}
|
||||
if _, err := n.Register(&ntfn1); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn1); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ func TestTxConfChainReorg(t *testing.T) {
|
||||
NumConfirmations: tx2NumConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(tx2NumConfs),
|
||||
}
|
||||
if _, err := n.Register(&ntfn2); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn2); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ func TestTxConfChainReorg(t *testing.T) {
|
||||
NumConfirmations: tx3NumConfs,
|
||||
Event: chainntnfs.NewConfirmationEvent(tx3NumConfs),
|
||||
}
|
||||
if _, err := n.Register(&ntfn3); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn3); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
|
||||
@ -723,14 +723,14 @@ func TestTxConfHeightHintCache(t *testing.T) {
|
||||
Event: chainntnfs.NewConfirmationEvent(2),
|
||||
}
|
||||
|
||||
if _, err := n.Register(ntfn1); err != nil {
|
||||
if _, err := n.RegisterConf(ntfn1); err != nil {
|
||||
t.Fatalf("unable to register tx1: %v", err)
|
||||
}
|
||||
if _, err := n.Register(ntfn2); err != nil {
|
||||
if _, err := n.RegisterConf(ntfn2); err != nil {
|
||||
t.Fatalf("unable to register tx2: %v", err)
|
||||
}
|
||||
|
||||
// Both transactions should not have a height hint set, as Register
|
||||
// Both transactions should not have a height hint set, as RegisterConf
|
||||
// should not alter the cache state.
|
||||
_, err := hintCache.QueryConfirmHint(tx1Hash)
|
||||
if err != chainntnfs.ErrConfirmHintNotFound {
|
||||
@ -903,7 +903,7 @@ func TestTxConfTearDown(t *testing.T) {
|
||||
NumConfirmations: 1,
|
||||
Event: chainntnfs.NewConfirmationEvent(1),
|
||||
}
|
||||
if _, err := n.Register(&ntfn1); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn1); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
if err := n.UpdateConfDetails(*ntfn1.TxID, nil); err != nil {
|
||||
@ -916,7 +916,7 @@ func TestTxConfTearDown(t *testing.T) {
|
||||
NumConfirmations: 2,
|
||||
Event: chainntnfs.NewConfirmationEvent(2),
|
||||
}
|
||||
if _, err := n.Register(&ntfn2); err != nil {
|
||||
if _, err := n.RegisterConf(&ntfn2); err != nil {
|
||||
t.Fatalf("unable to register ntfn: %v", err)
|
||||
}
|
||||
if err := n.UpdateConfDetails(*ntfn2.TxID, nil); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user