github.com/aergoio/aergo@v1.3.1/p2p/configs.go (about) 1 /* 2 * @file 3 * @copyright defined in aergo/LICENSE.txt 4 */ 5 6 package p2p 7 8 import "time" 9 10 // constants for peer communicating 11 const ( 12 // peer handshake will be failed when taken more than defaultHandshakeTTL 13 defaultHandshakeTTL = time.Second * 20 14 15 defaultPingInterval = time.Second * 60 16 // txNoticeInterval is max wait time when not sufficient txs to notify is collected. i.e newTxNotice is sent to peer within this time. 17 txNoticeInterval = time.Second * 1 18 // writeMsgBufferSize is queue size of message to a peer. connection will be closed when queue is exceeded. 19 writeMsgBufferSize = 40 20 ) 21 22 // constants for legacy sync algorithm. DEPRECATED newer sync logging in syncer package is used now. 23 const ( 24 SyncWorkTTL = time.Second * 30 25 AddBlockCheckpoint = 100 26 AddBlockWaitTime = time.Second * 10 27 ) 28 29 // constants for node discovery 30 const ( 31 DiscoveryQueryInterval = time.Minute * 1 32 33 MaxAddrListSizePolaris = 200 34 MaxAddrListSizePeer = 50 35 ) 36 37 // constants for peer internal operations 38 const ( 39 cleanRequestInterval = time.Hour 40 41 syncManagerChanSize = 500 42 ) 43 44 // constants for caching 45 // TODO this value better related to max peer and block produce interval, not constant 46 const ( 47 DefaultGlobalBlockCacheSize = 300 48 DefaultPeerBlockCacheSize = 100 49 50 DefaultGlobalTxCacheSize = 50000 51 DefaultPeerTxCacheSize = 10000 52 // DefaultPeerTxQueueSize is maximum size of hashes in a single tx notice message 53 DefaultPeerTxQueueSize = 2000 54 // value to sent to cache, since block and tx cache need only hash itself (stored as key of map) 55 cachePlaceHolder = true 56 ) 57 58 // constants for block notice tuning 59 const ( 60 GapToSkipAll = 86400 61 GapToSkipHourly = 3600 62 GapToSkip5Min = 300 63 64 HourlyInterval = time.Hour 65 TenMinutesInterval = time.Minute * 10 66 MinNewBlkNoticeInterval = time.Second >> 2 67 )