20 #include <libethashseal/Ethash.h> 21 #include <libethashseal/EthashClient.h> 25 #include <aleth/buildinfo.h> 27 #include <boost/filesystem.hpp> 28 #include <boost/algorithm/string.hpp> 36 static_assert(BOOST_VERSION >= 106400,
"Wrong boost headers version");
38 WebThreeDirect::WebThreeDirect(std::string
const& _clientVersion,
39 boost::filesystem::path
const& _dbPath, boost::filesystem::path
const& _snapshotPath,
42 : m_clientVersion(_clientVersion), m_net(_clientVersion, _n, _network)
46 _params, (
int)_params.
networkID, m_net, shared_ptr<GasPricer>(), _dbPath, _we));
50 m_ethereum.reset(
new eth::EthashClient(_params, (
int)_params.
networkID, m_net,
51 shared_ptr<GasPricer>(), _dbPath, _snapshotPath, _we));
54 shared_ptr<GasPricer>(), _dbPath, _snapshotPath, _we));
59 m_ethereum->startWorking();
61 const auto* buildinfo = aleth_get_buildinfo();
62 m_ethereum->setExtraData(
rlpList(0,
string{buildinfo->project_version}.substr(0, 5) +
"++" +
63 string{buildinfo->git_commit_hash}.substr(0, 4) +
64 string{buildinfo->build_type}.substr(0, 1) +
65 string{buildinfo->system_name}.substr(0, 5) +
66 string{buildinfo->compiler_id}.substr(0, 3)));
86 const auto* buildinfo = aleth_get_buildinfo();
87 return _client +
"/" + buildinfo->project_version +
"/" + buildinfo->system_name +
"/" +
88 buildinfo->compiler_id + buildinfo->compiler_version +
"/" + buildinfo->build_type;
93 return m_net.peerSessionInfo();
98 return m_net.peerCount();
103 return m_net.setIdealPeerCount(_n);
108 return m_net.setPeerStretch(_n);
113 return m_net.saveNetwork();
118 m_net.addNode(_node, NodeIPEndpoint(_host.address(), _host.port(), _host.port()));
123 m_net.requirePeer(_node, NodeIPEndpoint(_host.address(), _host.port(), _host.port()));
128 m_net.addPeer(_s, _t);
static std::string composeClientVersion(std::string const &_client)
std::vector< p2p::PeerSessionInfo > peers() override
Get information on the current peer set.
size_t peerCount() const override
Same as peers().size(), but more efficient.
void requirePeer(p2p::NodeID const &_node, bi::tcp::endpoint const &_endpoint) override
Require connection to peer.
dev::bytes saveNetwork() override
Save peers.
~WebThreeDirect() override
Destructor.
std::vector< byte > bytes
Main API hub for interfacing with Ethereum.
bytes rlpList()
Export a list of items in RLP format, returning a byte array.
void setPeerStretch(size_t _n)
Experimental. Sets ceiling for incoming connections to multiple of ideal peer count.
std::string sealEngineName
The chain sealer name: e.g. Ethash, NoProof, BasicAuthority.
virtual void addNode(p2p::NodeID const &_node, bi::tcp::endpoint const &_hostEndpoint) override
Add node to connect to.
boost::error_info< struct tag_comment, std::string > errinfo_comment
virtual void addPeer(p2p::NodeSpec const &_node, p2p::PeerType _t) override
Generalised peer addition.
void setIdealPeerCount(size_t _n) override
Sets the ideal number of peers.