23 #include <boost/filesystem.hpp> 24 #include <boost/algorithm/string.hpp> 29 #include "BuildInfo.h" 37 static_assert(BOOST_VERSION == 106300,
"Wrong boost headers version");
39 WebThreeDirect::WebThreeDirect(
40 std::string
const& _clientVersion,
41 std::string
const& _dbPath,
44 std::set<std::string>
const& _interfaces,
49 m_clientVersion(_clientVersion),
50 m_net(_clientVersion, _n, _network)
53 Defaults::setDBPath(_dbPath);
54 if (_interfaces.count(
"eth"))
66 boost::split(bps, bp, boost::is_any_of(
"/"));
67 bps[0] = bps[0].substr(0, 5);
68 bps[1] = bps[1].substr(0, 3);
69 bps.back() = bps.back().substr(0, 3);
73 if (_interfaces.count(
"shh"))
95 return _client +
"/" + \
101 string(
DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) + \
102 (ETH_CLEAN_REPO ?
"" :
"*") +
"/";
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
void setIdealPeerCount(unsigned _n)
Set ideal number of peers.
static std::string composeClientVersion(std::string const &_client)
~WebThreeDirect()
Destructor.
void stopNetwork() override
Stop the network subsystem.
void addPeer(NodeSpec const &_s, PeerType _t)
Add a potential peer.
NetworkPreferences const & networkPreferences() const
std::hash for asio::adress
size_t peerCount() const
Get number of peers connected.
std::vector< p2p::PeerSessionInfo > peers() override
Get information on the current peer set.
bytes saveNetwork() const
Serialise the set of known peers.
std::unique_ptr< eth::Client > m_ethereum
Client for Ethereum ("eth") protocol.
size_t peerCount() const override
Same as peers().size(), but more efficient.
p2p::NetworkPreferences const & networkPreferences() const override
void requirePeer(p2p::NodeID const &_node, bi::tcp::endpoint const &_endpoint) override
Require connection to peer.
std::weak_ptr< shh::WhisperHost > m_whisper
Client for Whisper ("shh") protocol.
dev::bytes saveNetwork() override
Save peers.
p2p::Host m_net
Should run in background and send us events when blocks found and allow us to send blocks as required...
PeerSessionInfos peerSessionInfo() const
Get peer information.
std::vector< byte > bytes
void requirePeer(NodeID const &_node, NodeIPEndpoint const &_endpoint)
Create Peer and attempt keeping peer connected.
Main API hub for interfacing with Ethereum.
void setPeerStretch(unsigned _n)
Set multipier for max accepted connections.
void setNetworkPreferences(p2p::NetworkPreferences const &_n, bool _dropPeers=false) override
void addNode(NodeID const &_node, NodeIPEndpoint const &_endpoint)
Add node as a peer candidate. Node is added if discovery ping is successful and table has capacity...
bytes rlpList()
Export a list of items in RLP format, returning a byte array.
bool isNetworkStarted() const override
Is network working? there may not be any peers yet.
void setPeerStretch(size_t _n)
Experimental. Sets ceiling for incoming connections to multiple of ideal peer count.
u256 u256Param(std::string const &_name) const
Convenience method to get an otherParam as a u256 int.
std::shared_ptr< T > registerCapability(std::shared_ptr< T > const &_t)
Register a peer-capability; all new peer connections will have this capability.
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.
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.
void setNetworkPreferences(NetworkPreferences const &_p, bool _dropPeers=false)
void startNetwork() override
Start the network subsystem.