Skip to content

Commit

Permalink
#21 progress reporting minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolse committed Nov 20, 2018
1 parent bea6801 commit b02df31
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
14 changes: 10 additions & 4 deletions node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,20 @@ void Node::Processor::AdjustFossilEnd(Height& h)

void Node::Processor::OnStateData()
{
++m_DownloadedHeaders;
ReportProgress();
if (m_DownloadedHeaders < m_RequestedCount)
{
++m_DownloadedHeaders;
ReportProgress();
}
}

void Node::Processor::OnBlockData()
{
++m_DownloadedBlocks;
ReportProgress();
if (m_DownloadedBlocks < m_RequestedCount)
{
++m_DownloadedBlocks;
ReportProgress();
}
}

bool Node::Processor::OpenMacroblock(Block::BodyBase::RW& rw, const NodeDB::StateID& sid)
Expand Down
11 changes: 7 additions & 4 deletions ui/viewmodel/restore_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ void RestoreViewModel::onSyncProgressUpdated(int done, int total)

void RestoreViewModel::onNodeSyncProgressUpdated(int done, int total)
{
_nodeDone = done;
_nodeTotal = total;
updateProgress();
if (!_walletConnected) // ignore node progress if wallet is connected
{
_nodeDone = done;
_nodeTotal = total;
updateProgress();
}
}

void RestoreViewModel::updateProgress()
Expand All @@ -94,7 +97,7 @@ void RestoreViewModel::updateProgress()
}
nodeSyncProgress = static_cast<double>(_nodeDone) / _nodeTotal;
}

if (nodeSyncProgress >= 1.0 && _walletConnected == false)
{
syncWithNode();
Expand Down

0 comments on commit b02df31

Please sign in to comment.