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 31 of file BlockChainSync.h.

Constructor & Destructor Documentation

◆ BlockChainSync()

BlockChainSync::BlockChainSync ( EthereumCapability _host)
explicit

Definition at line 140 of file BlockChainSync.cpp.

◆ ~BlockChainSync()

BlockChainSync::~BlockChainSync ( )

Definition at line 155 of file BlockChainSync.cpp.

Member Function Documentation

◆ abortSync()

void BlockChainSync::abortSync ( )

Abort all sync activity.

Definition at line 174 of file BlockChainSync.cpp.

◆ completeSync()

void BlockChainSync::completeSync ( )

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

Definition at line 851 of file BlockChainSync.cpp.

◆ isSyncing()

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

Definition at line 863 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 161 of file BlockChainSync.cpp.

◆ onPeerAborting()

void BlockChainSync::onPeerAborting ( )

Called by peer when it is disconnecting.

Definition at line 917 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 574 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 430 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 728 of file BlockChainSync.cpp.

◆ onPeerNewHashes()

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

Definition at line 868 of file BlockChainSync.cpp.

◆ onPeerStatus()

void BlockChainSync::onPeerStatus ( EthereumPeer const &  _peer)

Called by peer to report status.

Definition at line 181 of file BlockChainSync.cpp.

◆ restartSync()

void BlockChainSync::restartSync ( )

Restart sync.

Definition at line 839 of file BlockChainSync.cpp.

◆ stateName()

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

Definition at line 71 of file BlockChainSync.h.

◆ status()

SyncStatus BlockChainSync::status ( ) const
Returns
Synchonization status

Definition at line 814 of file BlockChainSync.cpp.


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