Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
node_rpc_proxy.h
Go to the documentation of this file.
1
// Copyright (c) 2017-Present, Electroneum
2
// Copyright (c) 2017-2019, The Monero Project
3
//
4
// All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or without modification, are
7
// permitted provided that the following conditions are met:
8
//
9
// 1. Redistributions of source code must retain the above copyright notice, this list of
10
// conditions and the following disclaimer.
11
//
12
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
13
// of conditions and the following disclaimer in the documentation and/or other
14
// materials provided with the distribution.
15
//
16
// 3. Neither the name of the copyright holder nor the names of its contributors may be
17
// used to endorse or promote products derived from this software without specific
18
// prior written permission.
19
//
20
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30
#pragma once
31
32
#include <string>
33
#include <boost/thread/mutex.hpp>
34
#include "
include_base_utils.h
"
35
#include "
net/http_client.h
"
36
37
namespace
tools
38
{
39
40
class
NodeRPCProxy
41
{
42
public
:
43
NodeRPCProxy
(
epee::net_utils::http::http_simple_client
&http_client, boost::recursive_mutex &mutex);
44
45
void
invalidate
();
46
void
set_offline
(
bool
offline) { m_offline = offline; }
47
48
boost::optional<std::string>
get_rpc_version
(
uint32_t
&
version
)
const
;
49
boost::optional<std::string>
get_height
(
uint64_t
&
height
)
const
;
50
void
set_height
(
uint64_t
h);
51
boost::optional<std::string>
get_target_height
(
uint64_t
&
height
)
const
;
52
boost::optional<std::string>
get_block_weight_limit
(
uint64_t
&block_weight_limit)
const
;
53
boost::optional<std::string>
get_earliest_height
(
uint8_t
version
,
uint64_t
&earliest_height)
const
;
54
boost::optional<std::string>
get_dynamic_base_fee_estimate
(
uint64_t
grace_blocks,
uint64_t
&fee)
const
;
55
boost::optional<std::string>
get_fee_quantization_mask
(
uint64_t
&fee_quantization_mask)
const
;
56
57
private
:
58
boost::optional<std::string> get_info()
const
;
59
60
epee::net_utils::http::http_simple_client
&m_http_client;
61
boost::recursive_mutex &m_daemon_rpc_mutex;
62
bool
m_offline;
63
64
mutable
uint64_t
m_height;
65
mutable
uint64_t
m_earliest_height[256];
66
mutable
uint64_t
m_dynamic_base_fee_estimate;
67
mutable
uint64_t
m_dynamic_base_fee_estimate_cached_height;
68
mutable
uint64_t
m_dynamic_base_fee_estimate_grace_blocks;
69
mutable
uint64_t
m_fee_quantization_mask;
70
mutable
uint32_t
m_rpc_version;
71
mutable
uint64_t
m_target_height;
72
mutable
uint64_t
m_block_weight_limit;
73
mutable
time_t m_get_info_time;
74
};
75
76
}
height
uint64_t height
Definition
blockchain.cpp:91
version
uint8_t version
Definition
blockchain.cpp:90
tools::NodeRPCProxy::get_target_height
boost::optional< std::string > get_target_height(uint64_t &height) const
Definition
node_rpc_proxy.cpp:123
tools::NodeRPCProxy::get_rpc_version
boost::optional< std::string > get_rpc_version(uint32_t &version) const
Definition
node_rpc_proxy.cpp:64
tools::NodeRPCProxy::get_earliest_height
boost::optional< std::string > get_earliest_height(uint8_t version, uint64_t &earliest_height) const
Definition
node_rpc_proxy.cpp:141
tools::NodeRPCProxy::get_fee_quantization_mask
boost::optional< std::string > get_fee_quantization_mask(uint64_t &fee_quantization_mask) const
Definition
node_rpc_proxy.cpp:196
tools::NodeRPCProxy::set_height
void set_height(uint64_t h)
Definition
node_rpc_proxy.cpp:84
tools::NodeRPCProxy::get_height
boost::optional< std::string > get_height(uint64_t &height) const
Definition
node_rpc_proxy.cpp:114
tools::NodeRPCProxy::get_dynamic_base_fee_estimate
boost::optional< std::string > get_dynamic_base_fee_estimate(uint64_t grace_blocks, uint64_t &fee) const
Definition
node_rpc_proxy.cpp:164
tools::NodeRPCProxy::invalidate
void invalidate()
Definition
node_rpc_proxy.cpp:49
tools::NodeRPCProxy::get_block_weight_limit
boost::optional< std::string > get_block_weight_limit(uint64_t &block_weight_limit) const
Definition
node_rpc_proxy.cpp:132
tools::NodeRPCProxy::set_offline
void set_offline(bool offline)
Definition
node_rpc_proxy.h:46
tools::NodeRPCProxy::NodeRPCProxy
NodeRPCProxy(epee::net_utils::http::http_simple_client &http_client, boost::recursive_mutex &mutex)
Definition
node_rpc_proxy.cpp:41
http_client.h
include_base_utils.h
epee::net_utils::http::http_simple_client
http_simple_client_template< blocked_mode_client > http_simple_client
Definition
http_client.h:1018
tools
Various Tools.
Definition
tools.cpp:31
uint32_t
unsigned int uint32_t
Definition
stdint.h:126
uint8_t
unsigned char uint8_t
Definition
stdint.h:124
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:136
src
wallet
node_rpc_proxy.h
Generated on
for Electroneum by
1.17.0