The EthereumPeer class.
More...
#include <EthereumPeer.h>
|
| | EthereumPeer (std::shared_ptr< p2p::SessionFace > _s, p2p::HostCapabilityFace *_h, unsigned _i, p2p::CapDesc const &_cap, uint16_t _capID) |
| | Basic constructor. More...
|
| |
| virtual | ~EthereumPeer () |
| | Basic destructor. More...
|
| |
| void | init (unsigned _hostProtocolVersion, u256 _hostNetworkId, u256 _chainTotalDifficulty, h256 _chainCurrentHash, h256 _chainGenesisHash, std::shared_ptr< EthereumHostDataFace > _hostData, std::shared_ptr< EthereumPeerObserverFace > _observer) |
| |
| p2p::NodeID | id () const |
| |
| void | setIdle () |
| | Abort sync and reset fetch. More...
|
| |
| void | requestBlockHeaders (h256 const &_startHash, unsigned _count, unsigned _skip, bool _reverse) |
| | Request hashes for given parent hash. More...
|
| |
| void | requestBlockHeaders (unsigned _startNumber, unsigned _count, unsigned _skip, bool _reverse) |
| |
| void | requestBlockBodies (h256s const &_blocks) |
| | Request specified blocks from peer. More...
|
| |
| void | requestNodeData (h256s const &_hashes) |
| | Request values for specified keys from peer. More...
|
| |
| void | requestReceipts (h256s const &_blocks) |
| | Request receipts for specified blocks from peer. More...
|
| |
| bool | isRude () const |
| | Check if this node is rude. More...
|
| |
| void | setRude () |
| | Set that it's a rude node. More...
|
| |
| void | abortSync () |
| | Abort the sync operation. More...
|
| |
| | Capability (std::shared_ptr< SessionFace > _s, HostCapabilityFace *_h, unsigned _idOffset, uint16_t _protocolID) |
| |
| virtual | ~Capability () |
| |
The EthereumPeer class.
- Todo:
- Document fully.
- Todo:
- make state transitions thread-safe.
Definition at line 83 of file EthereumPeer.h.
| EthereumPeer::~EthereumPeer |
( |
| ) |
|
|
virtual |
| void EthereumPeer::abortSync |
( |
| ) |
|
| unsigned EthereumPeer::askOverride |
( |
| ) |
const |
|
private |
Figure out the amount of blocks we should be asking for.
Definition at line 86 of file EthereumPeer.cpp.
| void dev::eth::EthereumPeer::clearKnownTransactions |
( |
| ) |
|
|
inlineprivate |
| bool EthereumPeer::interpret |
( |
unsigned |
_id, |
|
|
RLP const & |
_r |
|
) |
| |
|
privatevirtual |
Interpret an incoming message.
Packet layout: [ block: { P , B_32 }, maxHeaders: P, skip: P, reverse: P in { 0 , 1 } ]
Implements dev::p2p::Capability.
Definition at line 237 of file EthereumPeer.cpp.
| bool EthereumPeer::isConversing |
( |
| ) |
const |
|
private |
Are we presently in the process of communicating with this peer?
Definition at line 227 of file EthereumPeer.cpp.
| bool EthereumPeer::isCriticalSyncing |
( |
| ) |
const |
|
private |
Are we presently in a critical part of the syncing process with this peer?
Definition at line 232 of file EthereumPeer.cpp.
| bool EthereumPeer::isRude |
( |
| ) |
const |
| static unsigned dev::eth::EthereumPeer::messageCount |
( |
| ) |
|
|
inlinestatic |
| static std::string dev::eth::EthereumPeer::name |
( |
| ) |
|
|
inlinestatic |
| bool dev::eth::EthereumPeer::needsSyncing |
( |
| ) |
const |
|
inlineprivate |
Do we presently need syncing with this peer?
Definition at line 155 of file EthereumPeer.h.
| void EthereumPeer::requestBlockBodies |
( |
h256s const & |
_blocks | ) |
|
| void EthereumPeer::requestBlockHeaders |
( |
h256 const & |
_startHash, |
|
|
unsigned |
_count, |
|
|
unsigned |
_skip, |
|
|
bool |
_reverse |
|
) |
| |
| void EthereumPeer::requestBlockHeaders |
( |
unsigned |
_startNumber, |
|
|
unsigned |
_count, |
|
|
unsigned |
_skip, |
|
|
bool |
_reverse |
|
) |
| |
| void EthereumPeer::requestNodeData |
( |
h256s const & |
_hashes | ) |
|
| void EthereumPeer::requestReceipts |
( |
h256s const & |
_blocks | ) |
|
Request receipts for specified blocks from peer.
Definition at line 181 of file EthereumPeer.cpp.
| void EthereumPeer::requestStatus |
( |
u256 |
_hostNetworkId, |
|
|
u256 |
_chainTotalDifficulty, |
|
|
h256 |
_chainCurrentHash, |
|
|
h256 |
_chainGenesisHash |
|
) |
| |
|
private |
| void EthereumPeer::setAsking |
( |
Asking |
_g | ) |
|
|
private |
| void EthereumPeer::setIdle |
( |
| ) |
|
| void EthereumPeer::setRude |
( |
| ) |
|
| void EthereumPeer::tick |
( |
| ) |
|
|
private |
| static u256 dev::eth::EthereumPeer::version |
( |
| ) |
|
|
inlinestatic |
What, if anything, we last asked the other peer for.
Definition at line 175 of file EthereumPeer.h.
| h256 dev::eth::EthereumPeer::m_genesisHash |
|
private |
| unsigned dev::eth::EthereumPeer::m_hostProtocolVersion = 0 |
|
private |
| h256Hash dev::eth::EthereumPeer::m_knownBlocks |
|
private |
Blocks that the peer already knows about (that don't need to be sent to them).
Definition at line 189 of file EthereumPeer.h.
| h256Hash dev::eth::EthereumPeer::m_knownTransactions |
|
private |
Transactions that the peer already knows of.
Definition at line 191 of file EthereumPeer.h.
| std::atomic<time_t> dev::eth::EthereumPeer::m_lastAsk |
|
private |
When we asked for it. Allows a time out.
Definition at line 177 of file EthereumPeer.h.
| unsigned dev::eth::EthereumPeer::m_lastAskedHeaders = 0 |
|
private |
| h256 dev::eth::EthereumPeer::m_latestHash |
|
private |
These are determined through either a Status message or from NewBlock.
Peer's latest block's hash that we know about or default null value if no need to sync.
Definition at line 180 of file EthereumPeer.h.
| u256 dev::eth::EthereumPeer::m_networkId |
|
private |
| u256 const dev::eth::EthereumPeer::m_peerCapabilityVersion |
|
private |
Protocol version this peer supports received as capability.
Definition at line 184 of file EthereumPeer.h.
| unsigned dev::eth::EthereumPeer::m_protocolVersion |
|
private |
| bool dev::eth::EthereumPeer::m_requireTransactions = false |
|
private |
Have we received a GetTransactions packet that we haven't yet answered?
Definition at line 186 of file EthereumPeer.h.
| u256 dev::eth::EthereumPeer::m_totalDifficulty |
|
private |
Peer's latest block's total difficulty.
Definition at line 181 of file EthereumPeer.h.
| unsigned dev::eth::EthereumPeer::m_unknownNewBlocks = 0 |
|
private |
Number of unknown NewBlocks received from this peer.
Definition at line 192 of file EthereumPeer.h.
| Mutex dev::eth::EthereumPeer::x_knownBlocks |
|
private |
| Mutex dev::eth::EthereumPeer::x_knownTransactions |
|
private |
The documentation for this class was generated from the following files: