Only set bootstrap info if admin

Later on we restrict this, but are leaking it to non-admin users if we
hit this case.

(The caller is meant to check .untrusted to tell if the info came from a
bootstrap node).
This commit is contained in:
Jason Rhinelander 2020-09-25 16:37:09 -03:00
parent cf1ff3575e
commit 5ff901e446

View file

@ -349,17 +349,19 @@ namespace cryptonote { namespace rpc {
PERF_TIMER(on_get_info);
if (use_bootstrap_daemon_if_necessary<GET_INFO>(req, res))
{
if (context.admin)
{
crypto::hash top_hash;
m_core.get_blockchain_top(res.height_without_bootstrap.emplace(), top_hash);
++*res.height_without_bootstrap; // turn top block height into blockchain height
res.was_bootstrap_ever_used = true;
std::shared_lock lock{m_bootstrap_daemon_mutex};
if (m_bootstrap_daemon.get() != nullptr)
{
res.bootstrap_daemon_address = m_bootstrap_daemon->address();
}
}
crypto::hash top_hash;
m_core.get_blockchain_top(res.height_without_bootstrap.emplace(), top_hash);
++*res.height_without_bootstrap; // turn top block height into blockchain height
res.was_bootstrap_ever_used = true;
return res;
}