mirror of
https://github.com/monero-project/monero.git
synced 2026-01-14 05:46:37 -08:00
daemon: allow printing N blocks from the end of the chain
It's a very common usage (for my anyway) and avoids the need to get the current height, paste, subtract one, etc
This commit is contained in:
@@ -154,6 +154,16 @@ bool t_command_parser_executor::print_blockchain_info(const std::vector<std::str
|
||||
}
|
||||
uint64_t start_index = 0;
|
||||
uint64_t end_index = 0;
|
||||
if (args[0][0] == '-')
|
||||
{
|
||||
int64_t nblocks;
|
||||
if(!epee::string_tools::get_xtype_from_string(nblocks, args[0]))
|
||||
{
|
||||
std::cout << "wrong number of blocks" << std::endl;
|
||||
return false;
|
||||
}
|
||||
return m_executor.print_blockchain_info(nblocks, (uint64_t)-nblocks);
|
||||
}
|
||||
if(!epee::string_tools::get_xtype_from_string(start_index, args[0]))
|
||||
{
|
||||
std::cout << "wrong starter block index parameter" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user