fix: no_of_last_blocks if greater than blockchain height

https://github.com/moneroexamples/onion-monero-blockchain-explorer/
issues/141
This commit is contained in:
moneroexamples 2018-09-03 07:41:46 +08:00
parent 3125d4ae0a
commit 5fea46c28a
1 changed files with 3 additions and 3 deletions

View File

@ -582,12 +582,12 @@ index2(uint64_t page_no = 0, bool refresh_page = false)
uint64_t local_copy_server_timestamp = server_timestamp;
// number of last blocks to show
uint64_t no_of_last_blocks {no_blocks_on_index + 1};
// get the current blockchain height. Just to check
uint64_t height = core_storage->get_current_blockchain_height();
// number of last blocks to show
uint64_t no_of_last_blocks = std::min(no_blocks_on_index + 1, height);
// initalise page tempate map with basic info about blockchain
mstch::map context {
{"testnet" , testnet},