|
|
@ -94,7 +94,7 @@ void Client::init(p2p::Host* _extNet, std::string const& _dbPath, WithExisting _ |
|
|
|
|
|
|
|
m_lastGetWork = std::chrono::system_clock::now() - chrono::seconds(30); |
|
|
|
m_tqReady = m_tq.onReady([=](){ this->onTransactionQueueReady(); }); // TODO: should read m_tq->onReady(thisThread, syncTransactionQueue);
|
|
|
|
m_tqReplaced = m_tq.onReplaced([=](h256 const&){ this->resetState(); }); |
|
|
|
m_tqReplaced = m_tq.onReplaced([=](h256 const&){ m_needStateReset = true; }); |
|
|
|
m_bqReady = m_bq.onReady([=](){ this->onBlockQueueReady(); }); // TODO: should read m_bq->onReady(thisThread, syncBlockQueue);
|
|
|
|
m_bq.setOnBad([=](Exception& ex){ this->onBadBlock(ex); }); |
|
|
|
bc().setOnBad([=](Exception& ex){ this->onBadBlock(ex); }); |
|
|
@ -753,6 +753,12 @@ void Client::doWork() |
|
|
|
if (m_syncBlockQueue.compare_exchange_strong(t, false)) |
|
|
|
syncBlockQueue(); |
|
|
|
|
|
|
|
if (m_needStateReset) |
|
|
|
{ |
|
|
|
resetState(); |
|
|
|
m_needStateReset = false; |
|
|
|
} |
|
|
|
|
|
|
|
t = true; |
|
|
|
if (m_syncTransactionQueue.compare_exchange_strong(t, false) && !m_remoteWorking && !isSyncing()) |
|
|
|
syncTransactionQueue(); |
|
|
|