diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-11-04 17:36:46 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-11-04 17:38:14 +0000 |
commit | a633f85da905f737e024b29f0f3d72a2d68ae1f4 (patch) | |
tree | abcf947446a7f3e14040cba37180a6aafc54a219 /src/daemon/command_parser_executor.cpp | |
parent | Merge pull request #6087 (diff) | |
download | monero-a633f85da905f737e024b29f0f3d72a2d68ae1f4.tar.xz |
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
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-rw-r--r-- | src/daemon/command_parser_executor.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index b827221f6..967bd7278 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -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; |