Ethereum  PoC-8
The C++ Implementation of Ethereum
dev::eth::BlockChainSync Class Referencefinal

Base BlockChain synchronization strategy class. Syncs to peers and keeps up to date. Base class handles blocks downloading but does not contain any details on state transfer logic. More...

#include <BlockChainSync.h>

Inheritance diagram for dev::eth::BlockChainSync:
dev::HasInvariants

Public Member Functions

 BlockChainSync (EthereumCapability &_host)
 
 ~BlockChainSync ()
 
void abortSync ()
 Abort all sync activity. More...
 
bool isSyncing () const
 
void restartSync ()
 Restart sync. More...
 
void completeSync ()
 
void onPeerStatus (EthereumPeer const &_peer)
 Called by peer to report status. More...
 
void onPeerBlockHeaders (NodeID const &_peerID, RLP const &_r)
 Called by peer once it has new block headers during sync. More...
 
void onPeerBlockBodies (NodeID const &_peerID, RLP const &_r)
 Called by peer once it has new block bodies. More...
 
void onPeerNewBlock (NodeID const &_peerID, RLP const &_r)
 Called by peer once it has new block bodies. More...
 
void onPeerNewHashes (NodeID const &_peerID, std::vector< std::pair< h256, u256 >> const &_hashes)
 
void onPeerAborting ()
 Called by peer when it is disconnecting. More...
 
void onBlockImported (BlockHeader const &_info)
 Called when a blockchain has imported a new block onto the DB. More...
 
SyncStatus status () const
 

Static Public Member Functions

static char const * stateName (SyncState _s)
 

Detailed Description

Base BlockChain synchronization strategy class. Syncs to peers and keeps up to date. Base class handles blocks downloading but does not contain any details on state transfer logic.

Definition at line 48 of file BlockChainSync.h.

Constructor & Destructor Documentation

◆ BlockChainSync()

BlockChainSync::BlockChainSync ( EthereumCapability _host)
explicit

Definition at line 158 of file BlockChainSync.cpp.

◆ ~BlockChainSync()

BlockChainSync::~BlockChainSync ( )

Definition at line 173 of file BlockChainSync.cpp.

Member Function Documentation

◆ abortSync()

void BlockChainSync::abortSync ( )

Abort all sync activity.

Definition at line 192 of file BlockChainSync.cpp.

◆ completeSync()

void BlockChainSync::completeSync ( )

Called after all blocks have been downloaded Public only for test mode

Definition at line 869 of file BlockChainSync.cpp.

◆ isSyncing()

bool BlockChainSync::isSyncing ( ) const
Returns
true is Sync is in progress

Definition at line 881 of file BlockChainSync.cpp.

◆ onBlockImported()

void BlockChainSync::onBlockImported ( BlockHeader const &  _info)

Called when a blockchain has imported a new block onto the DB.

Definition at line 179 of file BlockChainSync.cpp.

◆ onPeerAborting()

void BlockChainSync::onPeerAborting ( )

Called by peer when it is disconnecting.

Definition at line 935 of file BlockChainSync.cpp.

◆ onPeerBlockBodies()

void BlockChainSync::onPeerBlockBodies ( NodeID const &  _peerID,
RLP const &  _r 
)

Called by peer once it has new block bodies.

Definition at line 592 of file BlockChainSync.cpp.

◆ onPeerBlockHeaders()

void BlockChainSync::onPeerBlockHeaders ( NodeID const &  _peerID,
RLP const &  _r 
)

Called by peer once it has new block headers during sync.

Definition at line 448 of file BlockChainSync.cpp.

◆ onPeerNewBlock()

void BlockChainSync::onPeerNewBlock ( NodeID const &  _peerID,
RLP const &  _r 
)

Called by peer once it has new block bodies.

Definition at line 746 of file BlockChainSync.cpp.

◆ onPeerNewHashes()

void BlockChainSync::onPeerNewHashes ( NodeID const &  _peerID,
std::vector< std::pair< h256, u256 >> const &  _hashes 
)

Definition at line 886 of file BlockChainSync.cpp.

◆ onPeerStatus()

void BlockChainSync::onPeerStatus ( EthereumPeer const &  _peer)

Called by peer to report status.

Definition at line 199 of file BlockChainSync.cpp.

◆ restartSync()

void BlockChainSync::restartSync ( )

Restart sync.

Definition at line 857 of file BlockChainSync.cpp.

◆ stateName()

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

Definition at line 88 of file BlockChainSync.h.

◆ status()

SyncStatus BlockChainSync::status ( ) const
Returns
Synchonization status

Definition at line 832 of file BlockChainSync.cpp.


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