Ethereum
PoC-8
The C++ Implementation of Ethereum
CommonNet.h
Go to the documentation of this file.
1
/*
2
This file is part of cpp-ethereum.
3
4
cpp-ethereum is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
cpp-ethereum is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16
*/
24
#pragma once
25
26
#include <
libdevcore/Common.h
>
27
#include <
libdevcore/Log.h
>
28
#include <libp2p/Common.h>
29
#include <chrono>
30
#include <string>
31
32
namespace
dev
33
{
34
35
class
OverlayDB;
36
37
namespace
eth
38
{
39
40
static
const
unsigned
c_maxHeaders = 2048;
41
static
const
unsigned
c_maxHeadersAsk = 2048;
42
static
const
unsigned
c_maxBlocks = 128;
43
static
const
unsigned
c_maxBlocksAsk = 128;
44
static
const
unsigned
c_maxPayload = 262144;
45
static
const
unsigned
c_maxNodes = c_maxBlocks;
46
static
const
unsigned
c_maxReceipts = c_maxBlocks;
47
48
class
BlockChain;
49
class
TransactionQueue;
50
class
EthereumCapability;
51
class
EthereumPeer;
52
53
enum
SubprotocolPacketType
:
byte
54
{
55
StatusPacket
= 0x00,
56
NewBlockHashesPacket
= 0x01,
57
TransactionsPacket
= 0x02,
58
GetBlockHeadersPacket
= 0x03,
59
BlockHeadersPacket
= 0x04,
60
GetBlockBodiesPacket
= 0x05,
61
BlockBodiesPacket
= 0x06,
62
NewBlockPacket
= 0x07,
63
64
GetNodeDataPacket
= 0x0d,
65
NodeDataPacket
= 0x0e,
66
GetReceiptsPacket
= 0x0f,
67
ReceiptsPacket
= 0x10,
68
69
PacketCount
70
};
71
72
enum class
Asking
73
{
74
State
,
75
BlockHeaders
,
76
BlockBodies
,
77
NodeData
,
78
Receipts
,
79
WarpManifest
,
80
WarpData
,
81
Nothing
82
};
83
84
enum class
SyncState
85
{
86
NotSynced
,
87
Idle
,
88
Waiting
,
89
Blocks
,
90
State
,
91
92
Size
93
};
94
95
struct
SyncStatus
96
{
97
SyncState
state
=
SyncState::Idle
;
98
unsigned
protocolVersion
= 0;
99
unsigned
startBlockNumber
;
100
unsigned
currentBlockNumber
;
101
unsigned
highestBlockNumber
;
102
bool
majorSyncing
=
false
;
103
};
104
105
using
NodeID
=
p2p::NodeID
;
106
}
107
}
dev::eth::Asking::WarpManifest
@ WarpManifest
dev::eth::SyncState::NotSynced
@ NotSynced
Initial chain sync has not started yet.
dev::eth::SyncStatus::majorSyncing
bool majorSyncing
Definition:
CommonNet.h:102
dev::eth::SyncStatus::startBlockNumber
unsigned startBlockNumber
Definition:
CommonNet.h:99
dev::eth::SyncState::Waiting
@ Waiting
Block downloading paused. Waiting for block queue to process blocks and free space.
dev::eth::SyncStatus
Definition:
CommonNet.h:96
dev::eth::ReceiptsPacket
@ ReceiptsPacket
Definition:
CommonNet.h:67
dev::eth::TransactionsPacket
@ TransactionsPacket
Definition:
CommonNet.h:57
dev::eth::SyncStatus::protocolVersion
unsigned protocolVersion
Definition:
CommonNet.h:98
dev::eth::GetBlockHeadersPacket
@ GetBlockHeadersPacket
Definition:
CommonNet.h:58
dev::eth::StatusPacket
@ StatusPacket
Definition:
CommonNet.h:55
dev::eth::SyncState::State
@ State
Downloading state.
dev::eth::SubprotocolPacketType
SubprotocolPacketType
Definition:
CommonNet.h:54
dev::eth::Asking::NodeData
@ NodeData
dev::eth::Asking::State
@ State
Common.h
dev::eth::SyncStatus::highestBlockNumber
unsigned highestBlockNumber
Definition:
CommonNet.h:101
dev::eth::Asking::Receipts
@ Receipts
dev::eth::PacketCount
@ PacketCount
Definition:
CommonNet.h:69
dev::eth::Asking
Asking
Definition:
CommonNet.h:73
dev::eth::GetBlockBodiesPacket
@ GetBlockBodiesPacket
Definition:
CommonNet.h:60
dev::eth::SyncStatus::currentBlockNumber
unsigned currentBlockNumber
Definition:
CommonNet.h:100
dev::eth::NodeID
p2p::NodeID NodeID
Definition:
CommonNet.h:105
dev::eth::SyncStatus::state
SyncState state
Definition:
CommonNet.h:97
dev::eth::SyncState
SyncState
Definition:
CommonNet.h:85
dev::eth::NewBlockPacket
@ NewBlockPacket
Definition:
CommonNet.h:62
dev::eth::NodeDataPacket
@ NodeDataPacket
Definition:
CommonNet.h:65
dev::eth::BlockBodiesPacket
@ BlockBodiesPacket
Definition:
CommonNet.h:61
dev::eth::GetNodeDataPacket
@ GetNodeDataPacket
Definition:
CommonNet.h:64
dev::eth::BlockHeadersPacket
@ BlockHeadersPacket
Definition:
CommonNet.h:59
dev::eth::SyncState::Size
@ Size
Must be kept last.
dev::eth::SyncState::Blocks
@ Blocks
Downloading blocks.
dev
Definition:
Address.cpp:21
dev::eth::NewBlockHashesPacket
@ NewBlockHashesPacket
Definition:
CommonNet.h:56
dev::eth::GetReceiptsPacket
@ GetReceiptsPacket
Definition:
CommonNet.h:66
dev::eth::Asking::BlockHeaders
@ BlockHeaders
dev::eth::SyncState::Idle
@ Idle
Initial chain sync complete. Waiting for new packets.
dev::eth::Asking::BlockBodies
@ BlockBodies
dev::eth::Asking::Nothing
@ Nothing
Log.h
dev::eth::Asking::WarpData
@ WarpData
libethereum
CommonNet.h
Generated on Fri Sep 20 2019 00:00:00 for Ethereum by
1.8.18