#36 simplewallet refresh include optional height param

height param is used optionally in refresh command 

TODO: This should also be the default behaviour 
when generating a new wallet.
This commit is contained in:
Jakob Lind
2014-08-01 10:17:50 +02:00
parent 7869667799
commit e4273f2415
9 changed files with 39 additions and 22 deletions

View File

@@ -622,12 +622,25 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
return true;
message_writer() << "Starting refresh...";
size_t fetched_blocks = 0;
size_t start_height = 0;
if(!args.empty()){
try
{
start_height = boost::lexical_cast<int>( args[0] );
}
catch(const boost::bad_lexical_cast &)
{
start_height = 0;
}
}
bool ok = false;
std::ostringstream ss;
try
{
m_wallet->refresh(fetched_blocks);
m_wallet->refresh(start_height, fetched_blocks);
ok = true;
// Clear line "Height xxx of xxx"
std::cout << "\r \r";