|
|
@ -613,10 +613,11 @@ bool Client::submitWork(ProofOfWork::Solution const& _solution) |
|
|
|
|
|
|
|
void Client::syncBlockQueue() |
|
|
|
{ |
|
|
|
ImportRoute ir; |
|
|
|
cwork << "BQ ==> CHAIN ==> STATE"; |
|
|
|
tie(ir.first, ir.second, m_syncBlockQueue) = m_bc.sync(m_bq, m_stateDB, rand() % 10 + 5); |
|
|
|
if (ir.first.empty()) |
|
|
|
pair <h256s, h256s> blocks; |
|
|
|
tie(blocks.first, blocks.second, m_syncBlockQueue) = m_bc.sync(m_bq, m_stateDB, rand() % 10 + 5); |
|
|
|
ImportRoute ir(blocks.second, blocks.first); |
|
|
|
if (ir.liveBlocks().empty()) |
|
|
|
return; |
|
|
|
onChainChanged(ir); |
|
|
|
} |
|
|
@ -658,7 +659,7 @@ void Client::syncTransactionQueue() |
|
|
|
void Client::onChainChanged(ImportRoute const& _ir) |
|
|
|
{ |
|
|
|
// insert transactions that we are declaring the dead part of the chain
|
|
|
|
for (auto const& h: _ir.second) |
|
|
|
for (auto const& h: _ir.deadBlocks()) |
|
|
|
{ |
|
|
|
clog(ClientNote) << "Dead block:" << h; |
|
|
|
for (auto const& t: m_bc.transactions(h)) |
|
|
@ -669,7 +670,7 @@ void Client::onChainChanged(ImportRoute const& _ir) |
|
|
|
} |
|
|
|
|
|
|
|
// remove transactions from m_tq nicely rather than relying on out of date nonce later on.
|
|
|
|
for (auto const& h: _ir.first) |
|
|
|
for (auto const& h: _ir.liveBlocks()) |
|
|
|
{ |
|
|
|
clog(ClientChat) << "Live block:" << h; |
|
|
|
for (auto const& th: m_bc.transactionHashes(h)) |
|
|
@ -683,7 +684,7 @@ void Client::onChainChanged(ImportRoute const& _ir) |
|
|
|
h->noteNewBlocks(); |
|
|
|
|
|
|
|
h256Hash changeds; |
|
|
|
for (auto const& h: _ir.first) |
|
|
|
for (auto const& h: _ir.liveBlocks()) |
|
|
|
appendFromNewBlock(h, changeds); |
|
|
|
|
|
|
|
// RESTART MINING
|
|
|
|