-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wallet2: check wallet compatibility with daemon's hard fork version [release] #8544
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,28 +82,50 @@ void NodeRPCProxy::invalidate() | |
m_rpc_payment_seed_hash = crypto::null_hash; | ||
m_rpc_payment_next_seed_hash = crypto::null_hash; | ||
m_height_time = 0; | ||
m_target_height_time = 0; | ||
m_rpc_payment_diff = 0; | ||
m_rpc_payment_credits_per_hash_found = 0; | ||
m_rpc_payment_height = 0; | ||
m_rpc_payment_cookie = 0; | ||
m_daemon_hard_forks.clear(); | ||
} | ||
|
||
boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version) | ||
boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version, std::vector<std::pair<uint8_t, uint64_t>> &daemon_hard_forks, uint64_t &height, uint64_t &target_height) | ||
{ | ||
if (m_offline) | ||
return boost::optional<std::string>("offline"); | ||
if (m_rpc_version == 0) | ||
{ | ||
const time_t now = time(NULL); | ||
cryptonote::COMMAND_RPC_GET_VERSION::request req_t = AUTO_VAL_INIT(req_t); | ||
cryptonote::COMMAND_RPC_GET_VERSION::response resp_t = AUTO_VAL_INIT(resp_t); | ||
{ | ||
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex}; | ||
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_version", req_t, resp_t, m_http_client, rpc_timeout); | ||
RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "get_version"); | ||
} | ||
|
||
m_rpc_version = resp_t.version; | ||
m_daemon_hard_forks.clear(); | ||
for (const auto &hf : resp_t.hard_forks) | ||
m_daemon_hard_forks.push_back(std::make_pair(hf.hf_version, hf.height)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this method is called multiple times on the same object, then it's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
if (resp_t.current_height > 0 || resp_t.target_height > 0) | ||
{ | ||
m_height = resp_t.current_height; | ||
m_target_height = resp_t.target_height; | ||
m_height_time = now; | ||
m_target_height_time = now; | ||
} | ||
} | ||
|
||
rpc_version = m_rpc_version; | ||
daemon_hard_forks = m_daemon_hard_forks; | ||
boost::optional<std::string> result = get_height(height); | ||
if (result) | ||
return result; | ||
result = get_target_height(target_height); | ||
if (result) | ||
return result; | ||
return boost::optional<std::string>(); | ||
} | ||
|
||
|
@@ -138,6 +160,7 @@ boost::optional<std::string> NodeRPCProxy::get_info() | |
m_adjusted_time = resp_t.adjusted_time; | ||
m_get_info_time = now; | ||
m_height_time = now; | ||
m_target_height_time = now; | ||
} | ||
return boost::optional<std::string>(); | ||
} | ||
|
@@ -160,6 +183,13 @@ boost::optional<std::string> NodeRPCProxy::get_height(uint64_t &height) | |
|
||
boost::optional<std::string> NodeRPCProxy::get_target_height(uint64_t &height) | ||
{ | ||
const time_t now = time(NULL); | ||
if (now < m_target_height_time + 30) // re-cache every 30 seconds | ||
{ | ||
height = m_target_height; | ||
return boost::optional<std::string>(); | ||
} | ||
|
||
auto res = get_info(); | ||
if (res) | ||
return res; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems all errors always take this branch, the elseif/else below won't activate. I tried using a v0.18 wallet on a couple v0.17 nodes as well (including the one linked: http://support.ablative.hosting:18081), same thing.
These all return the old wallet error:
monerod
online, but it's v0.17.x.xmonerod
online, but connected to wrong portmonerod
offline, either local or remote1.2.3.4:18081
1:18081
(returns wallet outdated error after hanging for a bit)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @hinto-janaiyo . Should be fixed in #8585