Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Manager
- type Peer
- func (p *Peer) DoEthereumHandshake() error
- func (p *Peer) Head() (currentBlock common.Hash, td *big.Int)
- func (p *Peer) RequestHeadersByHash(origin common.Hash, amount int, skip int, reverse bool) error
- func (p *Peer) RequestHeadersByNumber(origin uint64, amount int, skip int, reverse bool) error
- func (p *Peer) String() string
- type Syncer
Constants ¶
const ( // protocol messages belonging to eth/62 StatusMsg = 0x00 NewBlockHashesMsg = 0x01 TxMsg = 0x02 GetBlockHeadersMsg = 0x03 BlockHeadersMsg = 0x04 GetBlockBodiesMsg = 0x05 BlockBodiesMsg = 0x06 NewBlockMsg = 0x07 // protocol messages belonging to eth/63 GetNodeDataMsg = 0x0d NodeDataMsg = 0x0e GetReceiptsMsg = 0x0f ReceiptsMsg = 0x10 // ethereum byzantium fork relevant information ByzantiumBlockNumber = 4370000 ByzantiumBlockHashStr = "0xb1fcff633029ee18ab6482b58ff8b6e95dd7c82a954c852157152a7a6d32785e" )
eth protocol message codes
Variables ¶
var ByzantiumBlockNumberBigInt = big.NewInt(ByzantiumBlockNumber)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // bootnodes file BootnodesPath string // node database path. Must be appointed outside this package NodeDatabasePath string // we can log what is going on with the go-ethereum/p2p library LibP2PDebug bool // Passing labels from one object to another DbPool *redis.Pool // activate this value to send updates on discovered and connected // peers to the database IsPeerScrapperActive bool // activate this value to start the block header syncing IsSyncBlockHeaderActive bool // the client's private key here PrivateKeyFilePath string }
Config is the configuration object for DevP2P
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the object that sets up the node as a devp2p peer, managing its connected peers, and communicating with the bridge through the assigned channels.
func NewManager ¶
NewManager returns a DevP2P Manager object
- defines bootnodes, and
- defines node database, to be used by the discovery functions of go-ethereum/p2p library.
* sets up the mustekala services database connection.
- sets up the peerstore, which , among other things, keeps track of the best available peer to send a message.
- sets up a custom p2p lib logger, to be able to get stats on dialing, encrypted and proto handshakes, as well as catching and printing those logs.
- sets up the server. See manager.protocolHandler() and handlerIncomingMsg() to understand a peer's lifecycle and the receiving of devp2p messages and sending to the bridge.
* sets up the block header syncer, if the option is enabled.
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer is an arrangement we use to organize the life cycle of a devp2p peer after it is dialed, and the encryption and protocol handshakes are performed. After a succesful ethereum handshake, this Peer can be added in the peerstore, to be managed for further requesting.
func (*Peer) DoEthereumHandshake ¶
DoEthereumHandshake initiates the ethereum handshake, sending the status message.
func (*Peer) RequestHeadersByHash ¶
RequestHeadersByHash fetches a batch of blocks' headers corresponding to the specified header query, based on the hash of an origin block.
func (*Peer) RequestHeadersByNumber ¶
RequestHeadersByNumber fetches a batch of blocks' headers corresponding to the specified header query, based on the number of an origin block.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package downloader contains the manual full chain synchronisation.
|
Package downloader contains the manual full chain synchronisation. |
Package metrics provides general system and process level metrics collection.
|
Package metrics provides general system and process level metrics collection. |