Browse Source

Make API room for major syncing. TBI.

cl-refactor
Gav Wood 10 years ago
parent
commit
0360be76f2
  1. 12
      libethereum/Client.cpp
  2. 1
      libethereum/Client.h

12
libethereum/Client.cpp

@ -355,6 +355,14 @@ bool Client::isSyncing() const
return false;
}
bool Client::isMajorSyncing() const
{
// TODO: only return true if it is actually doing a proper chain sync.
if (auto h = m_host.lock())
return h->isSyncing();
return false;
}
void Client::startedWorking()
{
// Synchronise the state according to the head of the block chain.
@ -702,7 +710,7 @@ void Client::onChainChanged(ImportRoute const& _ir)
// RESTART MINING
if (!isSyncing())
if (!isMajorSyncing())
{
bool preChanged = false;
State newPreMine;
@ -765,7 +773,7 @@ void Client::startMining()
void Client::rejigMining()
{
if ((wouldMine() || remoteActive()) && !isSyncing() && (!isChainBad() || mineOnBadChain()) /*&& (forceMining() || transactionsWaiting())*/)
if ((wouldMine() || remoteActive()) && !isMajorSyncing() && (!isChainBad() || mineOnBadChain()) /*&& (forceMining() || transactionsWaiting())*/)
{
cnote << "Rejigging mining...";
DEV_WRITE_GUARDED(x_working)

1
libethereum/Client.h

@ -219,6 +219,7 @@ public:
DownloadMan const* downloadMan() const;
bool isSyncing() const;
bool isMajorSyncing() const;
/// Sets the network id.
void setNetworkId(u256 _n);
/// Clears pending transactions. Just for debug use.

Loading…
Cancel
Save