chain: dispatch RescanFinished notification after BlockConnected

In this commit, we address a bug within the wallet when running with
Neutrino where it wouldn't be able to mark it as synced with the chain
due to not receiving a RescanFinished notification if it was a block
behind the chain. This happened because of the order in which the
notifications are delivered within the underlying Neutrino ChainService,
FilteredBlockConnected gets dispatched before BlockConnected. This
doesn't always work however because there is an implicit dependency
between them in which BlockConnected must occur first.

To address it, rather than switching the order in which the
notifications are dispatched, we just check if we can dispatch the final
RescanFinished notification after dispatching BlockConnected.

Co-Authored-By: Roei Erez <roeierez@gmail.com>
This commit is contained in:
Wilmer Paulino 2019-04-18 19:32:30 -07:00
parent 767a7a95cf
commit b3643ed7a9
No known key found for this signature in database
GPG key ID: 6DF57B9F9514972F

View file

@ -587,6 +587,10 @@ func (s *NeutrinoClient) onBlockConnected(hash *chainhash.Hash, height int32,
case <-s.rescanQuit:
}
}
// Check if we're able to dispatch our final RescanFinished notification
// after processing this block.
s.dispatchRescanFinished()
}
// dispatchRescanFinished determines whether we're able to dispatch our final