Add default value to max_height, otherwise it's 0

This commit is contained in:
Michał Sałaban 2018-02-05 18:19:41 +01:00
parent ed67e5c001
commit 6866ed469a
2 changed files with 5 additions and 3 deletions

View file

@ -39,6 +39,7 @@ using namespace epee;
#include "wallet/wallet_args.h" #include "wallet/wallet_args.h"
#include "common/command_line.h" #include "common/command_line.h"
#include "common/i18n.h" #include "common/i18n.h"
#include "cryptonote_config.h"
#include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_basic/account.h" #include "cryptonote_basic/account.h"
#include "multisig/multisig.h" #include "multisig/multisig.h"
@ -1803,11 +1804,11 @@ namespace tools
return false; return false;
} }
uint64_t min_height = 0, max_height = (uint64_t)-1; uint64_t min_height = 0, max_height = CRYPTONOTE_MAX_BLOCK_NUMBER;
if (req.filter_by_height) if (req.filter_by_height)
{ {
min_height = req.min_height; min_height = req.min_height;
max_height = req.max_height; max_height = req.max_height <= max_height ? req.max_height : max_height;
} }
if (req.in) if (req.in)

View file

@ -29,6 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once #pragma once
#include "cryptonote_config.h"
#include "cryptonote_protocol/cryptonote_protocol_defs.h" #include "cryptonote_protocol/cryptonote_protocol_defs.h"
#include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/subaddress_index.h" #include "cryptonote_basic/subaddress_index.h"
@ -1262,7 +1263,7 @@ namespace wallet_rpc
KV_SERIALIZE(pool); KV_SERIALIZE(pool);
KV_SERIALIZE(filter_by_height); KV_SERIALIZE(filter_by_height);
KV_SERIALIZE(min_height); KV_SERIALIZE(min_height);
KV_SERIALIZE(max_height); KV_SERIALIZE_OPT(max_height, (uint64_t)CRYPTONOTE_MAX_BLOCK_NUMBER);
KV_SERIALIZE(account_index); KV_SERIALIZE(account_index);
KV_SERIALIZE(subaddr_indices); KV_SERIALIZE(subaddr_indices);
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()