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
 
u256 version () const override
 
unsigned messageCount () const override
 
void onStarting () override
 
void onStopping () 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
 
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. Syncs to peers and sends new blocks and transactions.

Definition at line 97 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 392 of file EthereumCapability.cpp.

Member Function Documentation

◆ bq() [1/2]

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

Definition at line 127 of file EthereumCapability.h.

◆ bq() [2/2]

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

Definition at line 128 of file EthereumCapability.h.

◆ capabilityHost()

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

Definition at line 139 of file EthereumCapability.h.

◆ chain()

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

Definition at line 125 of file EthereumCapability.h.

◆ completeSync()

void EthereumCapability::completeSync ( )

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

Definition at line 450 of file EthereumCapability.cpp.

◆ db()

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

Definition at line 126 of file EthereumCapability.h.

◆ disablePeer()

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

Definition at line 946 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 693 of file EthereumCapability.cpp.

◆ isSyncing()

bool EthereumCapability::isSyncing ( ) const

Definition at line 636 of file EthereumCapability.cpp.

◆ messageCount()

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

Definition at line 106 of file EthereumCapability.h.

◆ name()

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

Definition at line 104 of file EthereumCapability.h.

◆ networkId()

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

Definition at line 112 of file EthereumCapability.h.

◆ noteNewBlocks()

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

Definition at line 122 of file EthereumCapability.h.

◆ noteNewTransactions()

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

Definition at line 121 of file EthereumCapability.h.

◆ onBlockImported()

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

Definition at line 123 of file EthereumCapability.h.

◆ onConnect()

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

Definition at line 675 of file EthereumCapability.cpp.

◆ onDisconnect()

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

Definition at line 685 of file EthereumCapability.cpp.

◆ onStarting()

void EthereumCapability::onStarting ( )
override

Definition at line 413 of file EthereumCapability.cpp.

◆ onStopping()

void EthereumCapability::onStopping ( )
override

Definition at line 419 of file EthereumCapability.cpp.

◆ peer() [1/2]

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

Definition at line 951 of file EthereumCapability.cpp.

◆ peer() [2/2]

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

Definition at line 956 of file EthereumCapability.cpp.

◆ protocolVersion()

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

Definition at line 111 of file EthereumCapability.h.

◆ reset()

void EthereumCapability::reset ( )

Definition at line 438 of file EthereumCapability.cpp.

◆ setNetworkId()

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

Definition at line 113 of file EthereumCapability.h.

◆ stateName()

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

Definition at line 131 of file EthereumCapability.h.

◆ status()

SyncStatus EthereumCapability::status ( ) const

Definition at line 641 of file EthereumCapability.cpp.

◆ version()

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

Definition at line 105 of file EthereumCapability.h.

Member Data Documentation

◆ c_oldProtocolVersion

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

Definition at line 133 of file EthereumCapability.h.


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