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 
54 {
55  StatusPacket = 0x00,
63 
68 
70 };
71 
72 enum class Asking
73 {
74  State,
77  NodeData,
78  Receipts,
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 {
98  unsigned protocolVersion = 0;
99  unsigned startBlockNumber;
102  bool majorSyncing = false;
103 };
104 
106 }
107 }
Definition: Address.cpp:20
unsigned startBlockNumber
Definition: CommonNet.h:99
uint8_t byte
Definition: Common.h:57
Downloading blocks.
unsigned protocolVersion
Definition: CommonNet.h:98
Initial chain sync complete. Waiting for new packets.
Initial chain sync has not started yet.
p2p::NodeID NodeID
Definition: CommonNet.h:105
Must be kept last.
SubprotocolPacketType
Definition: CommonNet.h:53
unsigned currentBlockNumber
Definition: CommonNet.h:100
Block downloading paused. Waiting for block queue to process blocks and free space.
unsigned highestBlockNumber
Definition: CommonNet.h:101
Downloading state.