diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2023-06-27 11:20:25 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2023-06-27 11:20:25 -0500 |
| commit | 60e9426ef2f27b5af7539393535475b0614e1262 (patch) | |
| tree | b07d4d1d1d10b13e74b9cd68a92adba697e5c23b /src/wallet/node_rpc_proxy.cpp | |
| parent | 1ce32d85364e6aa2896361bff9618328cf0123f1 (diff) | |
| parent | 65e13dbef1c3a4cc036919203eec2052a121f034 (diff) | |
| download | monzero-core-60e9426ef2f27b5af7539393535475b0614e1262.tar.gz monzero-core-60e9426ef2f27b5af7539393535475b0614e1262.tar.xz monzero-core-60e9426ef2f27b5af7539393535475b0614e1262.zip | |
Merge pull request #8566
65e13db wallet2: fix rescanning tx via scan_tx (j-berman)
Diffstat (limited to 'src/wallet/node_rpc_proxy.cpp')
| -rw-r--r-- | src/wallet/node_rpc_proxy.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/wallet/node_rpc_proxy.cpp b/src/wallet/node_rpc_proxy.cpp index 0a9ea8f7b..44c52df62 100644 --- a/src/wallet/node_rpc_proxy.cpp +++ b/src/wallet/node_rpc_proxy.cpp @@ -392,4 +392,26 @@ boost::optional<std::string> NodeRPCProxy::get_rpc_payment_info(bool mining, boo return boost::none; } +boost::optional<std::string> NodeRPCProxy::get_block_header_by_height(uint64_t height, cryptonote::block_header_response &block_header) +{ + if (m_offline) + return boost::optional<std::string>("offline"); + + cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::request req_t = AUTO_VAL_INIT(req_t); + cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::response resp_t = AUTO_VAL_INIT(resp_t); + req_t.height = height; + + { + const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex}; + uint64_t pre_call_credits = m_rpc_payment_state.credits; + req_t.client = cryptonote::make_rpc_payment_signature(m_client_id_secret_key); + bool r = net_utils::invoke_http_json_rpc("/json_rpc", "getblockheaderbyheight", req_t, resp_t, m_http_client, rpc_timeout); + RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "getblockheaderbyheight"); + check_rpc_cost(m_rpc_payment_state, "getblockheaderbyheight", resp_t.credits, pre_call_credits, COST_PER_BLOCK_HEADER); + } + + block_header = std::move(resp_t.block_header); + return boost::optional<std::string>(); +} + } |
