diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-11-03 14:52:16 -0800 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-11-03 14:52:16 -0800 |
commit | 06b044176201fc4be89439a03d05e7ad840f44e0 (patch) | |
tree | 4641b636fd85cff61b6ce489ff8289328dc587eb /src/wallet/node_rpc_proxy.cpp | |
parent | Merge pull request #6077 (diff) | |
parent | simplewallet: plug a timing leak (diff) | |
download | monero-06b044176201fc4be89439a03d05e7ad840f44e0.tar.xz |
Merge pull request #6074
38f691048 simplewallet: plug a timing leak (moneromooo-monero)
dcff02e4c epee: allow a random component in once_a_time timeouts (moneromooo-monero)
e10833024 wallet: reuse cached height when set after refresh (moneromooo-monero)
5956beaa1 wallet2: fix is_synced checking target height, not height (moneromooo-monero)
fd35e2304 wallet: fix another facet of "did I get some monero" information leak (moneromooo-monero)
d5472bd87 wallet2: do not send an unnecessary last getblocks.bin call on refresh (moneromooo-monero)
97ae7bb5c wallet2: do not repeatedly ask for pool txes sent to us (moneromooo-monero)
Diffstat (limited to 'src/wallet/node_rpc_proxy.cpp')
-rw-r--r-- | src/wallet/node_rpc_proxy.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wallet/node_rpc_proxy.cpp b/src/wallet/node_rpc_proxy.cpp index 731896715..15ea26044 100644 --- a/src/wallet/node_rpc_proxy.cpp +++ b/src/wallet/node_rpc_proxy.cpp @@ -77,6 +77,7 @@ void NodeRPCProxy::invalidate() m_rpc_payment_seed_height = 0; m_rpc_payment_seed_hash = crypto::null_hash; m_rpc_payment_next_seed_hash = crypto::null_hash; + m_height_time = 0; } boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version) @@ -101,6 +102,7 @@ boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version void NodeRPCProxy::set_height(uint64_t h) { m_height = h; + m_height_time = time(NULL); } boost::optional<std::string> NodeRPCProxy::get_info() @@ -126,12 +128,20 @@ boost::optional<std::string> NodeRPCProxy::get_info() m_target_height = resp_t.target_height; m_block_weight_limit = resp_t.block_weight_limit ? resp_t.block_weight_limit : resp_t.block_size_limit; m_get_info_time = now; + m_height_time = now; } return boost::optional<std::string>(); } boost::optional<std::string> NodeRPCProxy::get_height(uint64_t &height) { + const time_t now = time(NULL); + if (now < m_height_time + 30) // re-cache every 30 seconds + { + height = m_height; + return boost::optional<std::string>(); + } + auto res = get_info(); if (res) return res; |