Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com> Co-authored-by: ying tong <yingtong@z.cash>
This commit is contained in:
parent
773c2b515a
commit
f553ae3320
|
@ -606,7 +606,7 @@ void ThreadStartWalletNotifier()
|
||||||
{
|
{
|
||||||
CBlockIndex *pindexLastTip;
|
CBlockIndex *pindexLastTip;
|
||||||
|
|
||||||
// However, if a wallet is enabled, we actually want to start notifying
|
// If the wallet is compiled in and enabled, we want to start notifying
|
||||||
// from the block which corresponds with the wallet's view of the chain
|
// from the block which corresponds with the wallet's view of the chain
|
||||||
// tip. In particular, we want to handle the case where the node shuts
|
// tip. In particular, we want to handle the case where the node shuts
|
||||||
// down uncleanly, and on restart the chain's tip is potentially up to
|
// down uncleanly, and on restart the chain's tip is potentially up to
|
||||||
|
@ -668,10 +668,13 @@ void ThreadStartWalletNotifier()
|
||||||
// more than 100 blocks behind pindexLastTip. This can occur if the node
|
// more than 100 blocks behind pindexLastTip. This can occur if the node
|
||||||
// shuts down abruptly without being able to write out chainActive; the
|
// shuts down abruptly without being able to write out chainActive; the
|
||||||
// node writes chain data out roughly hourly, while the wallet writes it
|
// node writes chain data out roughly hourly, while the wallet writes it
|
||||||
// every 10 minutes. We need to wait for ThreadImport to catch up.
|
// every 10 minutes. We need to wait for ThreadImport to catch up, or any
|
||||||
|
// missing blocks to be fetched from peers.
|
||||||
while (true) {
|
while (true) {
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
|
|
||||||
|
{
|
||||||
|
LOCK(cs_main);
|
||||||
const CBlockIndex *pindexFork = chainActive.FindFork(pindexLastTip);
|
const CBlockIndex *pindexFork = chainActive.FindFork(pindexLastTip);
|
||||||
// We know we have the genesis block.
|
// We know we have the genesis block.
|
||||||
assert(pindexFork != nullptr);
|
assert(pindexFork != nullptr);
|
||||||
|
@ -681,6 +684,7 @@ void ThreadStartWalletNotifier()
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (timedOut()) {
|
if (timedOut()) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue