Ethereum  PoC-8
The C++ Implementation of Ethereum
dev::eth::EthereumCapability Class Reference

The EthereumCapability class. More...

#include <EthereumCapability.h>

Inheritance diagram for dev::eth::EthereumCapability:

Public Member Functions

 EthereumCapability (std::shared_ptr< p2p::CapabilityHostFace > _host, BlockChain const &_ch, OverlayDB const &_db, TransactionQueue &_tq, BlockQueue &_bq, u256 _networkId)
 Start server, but don't listen. More...
 
std::string name () const override
 
unsigned version () const override
 
p2p::CapDesc descriptor () const override
 
unsigned messageCount () const override
 
std::chrono::milliseconds backgroundWorkInterval () const override
 
unsigned protocolVersion () const
 
u256 networkId () const
 
void setNetworkId (u256 _n)
 
void reset ()
 
void completeSync ()
 Don't sync further - used only in test mode. More...
 
bool isSyncing () const
 
void noteNewTransactions ()
 
void noteNewBlocks ()
 
void onBlockImported (BlockHeader const &_info)
 
BlockChain const & chain () const
 
OverlayDB const & db () const
 
BlockQueuebq ()
 
BlockQueue const & bq () const
 
SyncStatus status () const
 
void onConnect (NodeID const &_nodeID, u256 const &_peerCapabilityVersion) override
 
void onDisconnect (NodeID const &_nodeID) override
 
bool interpretCapabilityPacket (NodeID const &_peerID, unsigned _id, RLP const &_r) override
 
void doBackgroundWork () override
 
p2p::CapabilityHostFace & capabilityHost ()
 
EthereumPeer const & peer (NodeID const &_peerID) const
 
EthereumPeerpeer (NodeID const &_peerID)
 
void disablePeer (NodeID const &_peerID, std::string const &_problem)
 

Static Public Member Functions

static char const * stateName (SyncState _s)
 

Static Public Attributes

static unsigned const c_oldProtocolVersion
 

Detailed Description

The EthereumCapability class.

Warning
None of this is thread-safe. You have been warned. @doWork Syncs to peers and sends new blocks and transactions.

Definition at line 84 of file EthereumCapability.h.

Constructor & Destructor Documentation

◆ EthereumCapability()

EthereumCapability::EthereumCapability ( std::shared_ptr< p2p::CapabilityHostFace >  _host,
BlockChain const &  _ch,
OverlayDB const &  _db,
TransactionQueue _tq,
BlockQueue _bq,
u256  _networkId 
)

Start server, but don't listen.

Definition at line 381 of file EthereumCapability.cpp.

Member Function Documentation

◆ backgroundWorkInterval()

std::chrono::milliseconds EthereumCapability::backgroundWorkInterval ( ) const
override

Definition at line 402 of file EthereumCapability.cpp.

◆ bq() [1/2]

BlockQueue& dev::eth::EthereumCapability::bq ( )
inline

Definition at line 113 of file EthereumCapability.h.

◆ bq() [2/2]

BlockQueue const& dev::eth::EthereumCapability::bq ( ) const
inline

Definition at line 114 of file EthereumCapability.h.

◆ capabilityHost()

p2p::CapabilityHostFace& dev::eth::EthereumCapability::capabilityHost ( )
inline

Definition at line 129 of file EthereumCapability.h.

◆ chain()

BlockChain const& dev::eth::EthereumCapability::chain ( ) const
inline

Definition at line 111 of file EthereumCapability.h.

◆ completeSync()

void EthereumCapability::completeSync ( )

Don't sync further - used only in test mode.

Definition at line 433 of file EthereumCapability.cpp.

◆ db()

OverlayDB const& dev::eth::EthereumCapability::db ( ) const
inline

Definition at line 112 of file EthereumCapability.h.

◆ descriptor()

p2p::CapDesc dev::eth::EthereumCapability::descriptor ( ) const
inlineoverride

Definition at line 93 of file EthereumCapability.h.

◆ disablePeer()

void EthereumCapability::disablePeer ( NodeID const &  _peerID,
std::string const &  _problem 
)

Definition at line 930 of file EthereumCapability.cpp.

◆ doBackgroundWork()

void EthereumCapability::doBackgroundWork ( )
override

Main work loop - sends new transactions and blocks to available peers and disconnects from timed out peers

Definition at line 852 of file EthereumCapability.cpp.

◆ interpretCapabilityPacket()

bool EthereumCapability::interpretCapabilityPacket ( NodeID const &  _peerID,
unsigned  _id,
RLP const &  _r 
)
override

Packet layout: [ block: { P , B_32 }, maxHeaders: P, skip: P, reverse: P in { 0 , 1 } ]

Definition at line 642 of file EthereumCapability.cpp.

◆ isSyncing()

bool EthereumCapability::isSyncing ( ) const

Definition at line 585 of file EthereumCapability.cpp.

◆ messageCount()

unsigned dev::eth::EthereumCapability::messageCount ( ) const
inlineoverride

Definition at line 94 of file EthereumCapability.h.

◆ name()

std::string dev::eth::EthereumCapability::name ( ) const
inlineoverride

Definition at line 91 of file EthereumCapability.h.

◆ networkId()

u256 dev::eth::EthereumCapability::networkId ( ) const
inline

Definition at line 98 of file EthereumCapability.h.

◆ noteNewBlocks()

void dev::eth::EthereumCapability::noteNewBlocks ( )
inline

Definition at line 108 of file EthereumCapability.h.

◆ noteNewTransactions()

void dev::eth::EthereumCapability::noteNewTransactions ( )
inline

Definition at line 107 of file EthereumCapability.h.

◆ onBlockImported()

void dev::eth::EthereumCapability::onBlockImported ( BlockHeader const &  _info)
inline

Definition at line 109 of file EthereumCapability.h.

◆ onConnect()

void EthereumCapability::onConnect ( NodeID const &  _nodeID,
u256 const &  _peerCapabilityVersion 
)
override

Definition at line 624 of file EthereumCapability.cpp.

◆ onDisconnect()

void EthereumCapability::onDisconnect ( NodeID const &  _nodeID)
override

Definition at line 634 of file EthereumCapability.cpp.

◆ peer() [1/2]

EthereumPeer & EthereumCapability::peer ( NodeID const &  _peerID)

Definition at line 940 of file EthereumCapability.cpp.

◆ peer() [2/2]

EthereumPeer const & EthereumCapability::peer ( NodeID const &  _peerID) const

Definition at line 935 of file EthereumCapability.cpp.

◆ protocolVersion()

unsigned dev::eth::EthereumCapability::protocolVersion ( ) const
inline

Definition at line 97 of file EthereumCapability.h.

◆ reset()

void EthereumCapability::reset ( )

Definition at line 421 of file EthereumCapability.cpp.

◆ setNetworkId()

void dev::eth::EthereumCapability::setNetworkId ( u256  _n)
inline

Definition at line 99 of file EthereumCapability.h.

◆ stateName()

static char const* dev::eth::EthereumCapability::stateName ( SyncState  _s)
inlinestatic

Definition at line 117 of file EthereumCapability.h.

◆ status()

SyncStatus EthereumCapability::status ( ) const

Definition at line 590 of file EthereumCapability.cpp.

◆ version()

unsigned dev::eth::EthereumCapability::version ( ) const
inlineoverride

Definition at line 92 of file EthereumCapability.h.

Member Data Documentation

◆ c_oldProtocolVersion

unsigned const dev::eth::EthereumCapability::c_oldProtocolVersion
static

Definition at line 119 of file EthereumCapability.h.


The documentation for this class was generated from the following files: