-
Notifications
You must be signed in to change notification settings - Fork 2
/
const.go
30 lines (23 loc) · 1.4 KB
/
const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package sync
import "time"
const (
// GetBlockHashesAmountCap is the cap of GetBlockHashes request
GetBlockHashesAmountCap = 50
// GetBlocksByNumAmountCap is the cap of request of a single GetBlocksByNum request.
// This number has an effect on maxMsgBytes as 20MB defined in github.com/PositionExchange/posichain/p2p/stream/types.
// Since we have an assumption that rlp encoded block size is smaller than 2MB (p2p.node.MaxMessageSize),
// so the max size of a stream message is capped at 2MB * 10 = 20MB.
GetBlocksByNumAmountCap = 10
// GetBlocksByHashesAmountCap is the cap of request of single GetBlocksByHashes request
// This number has an effect on maxMsgBytes as 20MB defined in github.com/PositionExchange/posichain/p2p/stream/types.
// See comments for GetBlocksByNumAmountCap.
GetBlocksByHashesAmountCap = 10
// minAdvertiseInterval is the minimum advertise interval
minAdvertiseInterval = 1 * time.Minute
// rateLimiterGlobalRequestPerSecond is the request per second limit for all streams in the sync protocol.
// This constant helps prevent the node resource from exhausting for being the stream sync host.
rateLimiterGlobalRequestPerSecond = 50
// rateLimiterSingleRequestsPerSecond is the request per second limit for a single stream in the sync protocol.
// This constant helps prevent the node resource from exhausting from a single remote node.
rateLimiterSingleRequestsPerSecond = 10
)