aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2014-12-12 11:01:17 +0000
committerwarptangent <warptangent@inbox.com>2015-01-04 19:39:42 -0800
commit609cf7fc92987da0585651a6e95225575ecacd09 (patch)
tree67b62db2231597c4b968cd0f161b400dc503dbf4
parentblockchain_converter: only call data path function once (diff)
downloadmonero-609cf7fc92987da0585651a6e95225575ecacd09.tar.xz
blockchain_converter: a bit more user friendly output
-rw-r--r--src/blockchain_converter/blockchain_converter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/blockchain_converter/blockchain_converter.cpp b/src/blockchain_converter/blockchain_converter.cpp
index 1ae1efc72..f2dd10b18 100644
--- a/src/blockchain_converter/blockchain_converter.cpp
+++ b/src/blockchain_converter/blockchain_converter.cpp
@@ -68,9 +68,13 @@ int main(int argc, char* argv[])
blockchain->open(default_data_path.string());
- for (uint64_t i = 0; i < c.m_storage.get_current_blockchain_height(); ++i)
+ for (uint64_t height, i = 0; i < (height = c.m_storage.get_current_blockchain_height()); ++i)
{
- if (i % 10 == 0) std::cout << "block " << i << std::endl;
+ if (i % 10 == 0)
+ {
+ std::cout << "\r \r" << "block " << i << "/" << height
+ << " (" << (i+1)*100/height<< "%)" << std::flush;
+ }
block b = c.m_storage.get_block(i);
size_t bsize = c.m_storage.get_block_size(i);
difficulty_type bdiff = c.m_storage.get_block_cumulative_difficulty(i);
@@ -81,6 +85,7 @@ int main(int argc, char* argv[])
c.m_storage.get_transactions(b.tx_hashes, txs, missed);
if (missed.size())
{
+ std::cout << std::endl;
std::cerr << "Missed transaction(s) for block at height " << i << ", exiting" << std::endl;
delete blockchain;
return 1;
@@ -92,12 +97,14 @@ int main(int argc, char* argv[])
}
catch (const std::exception& e)
{
+ std::cout << std::endl;
std::cerr << "Error adding block to new blockchain: " << e.what() << std::endl;
delete blockchain;
return 2;
}
}
+ std::cout << std::endl;
delete blockchain;
return 0;
}