chain/neutrino: fix deadlock
This commit is contained in:
parent
73dbcf3943
commit
78a69b4802
1 changed files with 2 additions and 3 deletions
|
@ -201,7 +201,6 @@ func (s *NeutrinoClient) Rescan(startHash *chainhash.Hash, addrs []btcutil.Addre
|
|||
// notification indicating the rescan has "finished".
|
||||
if header.BlockHash() == *startHash {
|
||||
s.finished = true
|
||||
s.clientMtx.Unlock()
|
||||
select {
|
||||
case s.enqueueNotification <- &RescanFinished{
|
||||
Hash: startHash,
|
||||
|
@ -213,7 +212,6 @@ func (s *NeutrinoClient) Rescan(startHash *chainhash.Hash, addrs []btcutil.Addre
|
|||
case <-s.rescanQuit:
|
||||
return nil
|
||||
}
|
||||
s.clientMtx.Lock()
|
||||
}
|
||||
|
||||
s.rescan = s.CS.NewRescan(
|
||||
|
@ -249,11 +247,11 @@ func (s *NeutrinoClient) NotifyBlocks() error {
|
|||
// NotifyReceived replicates the RPC client's NotifyReceived command.
|
||||
func (s *NeutrinoClient) NotifyReceived(addrs []btcutil.Address) error {
|
||||
s.clientMtx.Lock()
|
||||
defer s.clientMtx.Unlock()
|
||||
|
||||
// If we have a rescan running, we just need to add the appropriate
|
||||
// addresses to the watch list.
|
||||
if s.scanning {
|
||||
s.clientMtx.Unlock()
|
||||
return s.rescan.Update(neutrino.AddAddrs(addrs...))
|
||||
}
|
||||
|
||||
|
@ -276,6 +274,7 @@ func (s *NeutrinoClient) NotifyReceived(addrs []btcutil.Address) error {
|
|||
neutrino.WatchAddrs(addrs...),
|
||||
)
|
||||
s.rescanErr = s.rescan.Start()
|
||||
s.clientMtx.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue