chainntnfs/neutrino: start concurrent queues prior to connection
Similar to what was done for btcd, just to make sure we won't be blocked on any incoming notifications, start the queues first thing during startup.
This commit is contained in:
parent
6b6beb4d7d
commit
d195acc632
@ -116,12 +116,20 @@ func (n *NeutrinoNotifier) Start() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start our concurrent queues before starting the rescan, to ensure
|
||||||
|
// onFilteredBlockConnected and onRelavantTx callbacks won't be
|
||||||
|
// blocked.
|
||||||
|
n.chainUpdates.Start()
|
||||||
|
n.txUpdates.Start()
|
||||||
|
|
||||||
// First, we'll obtain the latest block height of the p2p node. We'll
|
// First, we'll obtain the latest block height of the p2p node. We'll
|
||||||
// start the auto-rescan from this point. Once a caller actually wishes
|
// start the auto-rescan from this point. Once a caller actually wishes
|
||||||
// to register a chain view, the rescan state will be rewound
|
// to register a chain view, the rescan state will be rewound
|
||||||
// accordingly.
|
// accordingly.
|
||||||
startingPoint, err := n.p2pNode.BestBlock()
|
startingPoint, err := n.p2pNode.BestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
n.txUpdates.Stop()
|
||||||
|
n.chainUpdates.Stop()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
n.bestBlock.Hash = &startingPoint.Hash
|
n.bestBlock.Hash = &startingPoint.Hash
|
||||||
@ -160,9 +168,6 @@ func (n *NeutrinoNotifier) Start() error {
|
|||||||
)
|
)
|
||||||
n.rescanErr = n.chainView.Start()
|
n.rescanErr = n.chainView.Start()
|
||||||
|
|
||||||
n.chainUpdates.Start()
|
|
||||||
n.txUpdates.Start()
|
|
||||||
|
|
||||||
n.wg.Add(1)
|
n.wg.Add(1)
|
||||||
go n.notificationDispatcher()
|
go n.notificationDispatcher()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user