45 virtual void onPeerStatus(std::shared_ptr<EthereumPeer> _peer) = 0;
53 virtual void onPeerNewHashes(std::shared_ptr<EthereumPeer> _peer, std::vector<std::pair<h256, u256>>
const& _hashes) = 0;
55 virtual void onPeerNewBlock(std::shared_ptr<EthereumPeer> _peer,
RLP const& _r) = 0;
57 virtual void onPeerNodeData(std::shared_ptr<EthereumPeer> _peer,
RLP const& _r) = 0;
59 virtual void onPeerReceipts(std::shared_ptr<EthereumPeer> _peer,
RLP const& _r) = 0;
69 virtual std::pair<bytes, unsigned> blockHeaders(
RLP const& _blockId,
unsigned _maxHeaders,
u256 _skip,
bool _reverse)
const = 0;
71 virtual std::pair<bytes, unsigned> blockBodies(
RLP const& _blockHashes)
const = 0;
73 virtual strings nodeData(
RLP const& _dataHashes)
const = 0;
75 virtual std::pair<bytes, unsigned> receipts(
RLP const& _blockHashes)
const = 0;
96 static std::string
name() {
return "eth"; }
104 void init(
unsigned _hostProtocolVersion,
u256 _hostNetworkId,
u256 _chainTotalDifficulty,
h256 _chainCurrentHash,
h256 _chainGenesisHash, std::shared_ptr<EthereumHostDataFace> _hostData, std::shared_ptr<EthereumPeerObserverFace> _observer);
112 void requestBlockHeaders(
h256 const& _startHash,
unsigned _count,
unsigned _skip,
bool _reverse);
113 void requestBlockHeaders(
unsigned _startNumber,
unsigned _count,
unsigned _skip,
bool _reverse);
116 void requestBlockBodies(
h256s const& _blocks);
119 void requestNodeData(
h256s const& _hashes);
122 void requestReceipts(
h256s const& _blocks);
137 unsigned askOverride()
const;
140 virtual bool interpret(
unsigned _id,
RLP const& _r);
143 void requestStatus(
u256 _hostNetworkId,
u256 _chainTotalDifficulty,
h256 _chainCurrentHash,
h256 _chainGenesisHash);
152 void setAsking(
Asking _g);
158 bool isConversing()
const;
161 bool isCriticalSyncing()
const;
166 unsigned m_hostProtocolVersion = 0;
185 bool m_requireTransactions =
false;
192 unsigned m_unknownNewBlocks = 0;
193 unsigned m_lastAskedHeaders = 0;
virtual void onPeerNewBlock(std::shared_ptr< EthereumPeer > _peer, RLP const &_r)=0
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
virtual void onPeerNewHashes(std::shared_ptr< EthereumPeer > _peer, std::vector< std::pair< h256, u256 >> const &_hashes)=0
u256 const m_peerCapabilityVersion
Protocol version this peer supports received as capability.
const unsigned c_protocolVersion
Current protocol version.
u256 m_totalDifficulty
Peer's latest block's total difficulty.
std::pair< std::string, u256 > CapDesc
bool needsSyncing() const
Do we presently need syncing with this peer?
std::vector< std::string > strings
std::atomic< time_t > m_lastAsk
When we asked for it. Allows a time out.
static u256 version()
What is our version?
virtual void onPeerReceipts(std::shared_ptr< EthereumPeer > _peer, RLP const &_r)=0
virtual void onPeerNodeData(std::shared_ptr< EthereumPeer > _peer, RLP const &_r)=0
virtual void onPeerAborting()=0
h256Hash m_knownBlocks
Blocks that the peer already knows about (that don't need to be sent to them).
u256 m_networkId
Peer's network id.
virtual void onPeerBlockBodies(std::shared_ptr< EthereumPeer > _peer, RLP const &_r)=0
unsigned m_protocolVersion
Peer's protocol version.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
virtual ~EthereumHostDataFace()
h256 m_latestHash
These are determined through either a Status message or from NewBlock.
Base BlockChain synchronization strategy class.
void sealAndSend(RLPStream &_s)
std::shared_ptr< EthereumPeerObserverFace > m_observer
static std::string name()
What is our name?
void clearKnownTransactions()
Clear all known transactions.
std::shared_ptr< EthereumHostDataFace > m_hostData
virtual void onPeerStatus(std::shared_ptr< EthereumPeer > _peer)=0
h256Hash m_knownTransactions
Transactions that the peer already knows of.
std::unordered_set< h256 > h256Hash
virtual ~EthereumPeerObserverFace()
Mutex x_knownTransactions
std::vector< h256 > h256s
Class for interpreting Recursive Linear-Prefix Data.
virtual void onPeerTransactions(std::shared_ptr< EthereumPeer > _peer, RLP const &_r)=0
static unsigned messageCount()
How many message types do we have?
h256 m_genesisHash
Peer's genesis hash.
virtual void onPeerBlockHeaders(std::shared_ptr< EthereumPeer > _peer, RLP const &_headers)=0