Skip to content

Commit

Permalink
Merge pull request tendermint#9 from BiJie/feature/change_default_params
Browse files Browse the repository at this point in the history
R4R: Change default params
  • Loading branch information
darren-liu committed Nov 21, 2018
2 parents cf1745a + ed87b99 commit 759be18
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ func DefaultP2PConfig() *P2PConfig {
AddrBookStrict: true,
MaxNumInboundPeers: 40,
MaxNumOutboundPeers: 10,
FlushThrottleTimeout: 100,
MaxPacketMsgPayloadSize: 1024, // 1 kB
SendRate: 5120000, // 5 mB/s
RecvRate: 5120000, // 5 mB/s
FlushThrottleTimeout: 10,
MaxPacketMsgPayloadSize: 1024 * 1024, // 1 MB
SendRate: 50 * 1024 * 1024, // 50 MB/s
RecvRate: 50 * 1024 * 1024, // 50 MB/s
PexReactor: true,
SeedMode: false,
AllowDuplicateIP: true, // so non-breaking yet
Expand Down Expand Up @@ -488,7 +488,7 @@ func DefaultConsensusConfig() *ConsensusConfig {
SkipTimeoutCommit: false,
CreateEmptyBlocks: true,
CreateEmptyBlocksInterval: 0,
PeerGossipSleepDuration: 100,
PeerGossipSleepDuration: 10,
PeerQueryMaj23SleepDuration: 2000,
BlockTimeIota: 1000,
}
Expand Down
3 changes: 2 additions & 1 deletion mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ func (mem *Mempool) ReapMaxBytesMaxGas(maxBytes, maxGas int64) types.Txs {
for e := mem.txs.Front(); e != nil; e = e.Next() {
memTx := e.Value.(*mempoolTx)
// Check total size requirement
aminoOverhead := int64(amino.UvarintSize(uint64(len(memTx.tx))))
// TODO: merge tendermint
aminoOverhead := int64(amino.UvarintSize(uint64(len(memTx.tx)))) + 1
if maxBytes > -1 && totalBytes+int64(len(memTx.tx))+aminoOverhead > maxBytes {
return txs
}
Expand Down
6 changes: 3 additions & 3 deletions mempool/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
const (
MempoolChannel = byte(0x30)

maxMsgSize = 1048576 // 1MB TODO make it configurable
peerCatchupSleepIntervalMS = 100 // If peer is behind, sleep this amount
MempoolPacketChannelSize = 1024 * 8 // 8K messages can be queued
maxMsgSize = 1048576 // 1MB TODO make it configurable
peerCatchupSleepIntervalMS = 100 // If peer is behind, sleep this amount
MempoolPacketChannelSize = 1024 * 200 // 200K messages can be queued
)

type MempoolPacket struct {
Expand Down
10 changes: 5 additions & 5 deletions p2p/conn/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

const (
defaultMaxPacketMsgPayloadSize = 1024
defaultMaxPacketMsgPayloadSize = 1024 * 1024 // 1MB

numBatchPacketMsgs = 10
minReadBufferSize = 1024
Expand All @@ -28,13 +28,13 @@ const (
// some of these defaults are written in the user config
// flushThrottle, sendRate, recvRate
// TODO: remove values present in config
defaultFlushThrottle = 100 * time.Millisecond
defaultFlushThrottle = 10 * time.Millisecond

defaultSendQueueCapacity = 1
defaultRecvBufferCapacity = 4096
defaultRecvMessageCapacity = 22020096 // 21MB
defaultSendRate = int64(512000) // 500KB/s
defaultRecvRate = int64(512000) // 500KB/s
defaultRecvMessageCapacity = 22020096 // 21MB
defaultSendRate = int64(50 * 1024 * 1024) // 50MB/s
defaultRecvRate = int64(50 * 1024 * 1024) // 50MKB/s
defaultSendTimeout = 10 * time.Second
defaultPingInterval = 60 * time.Second
defaultPongTimeout = 45 * time.Second
Expand Down
4 changes: 2 additions & 2 deletions types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (
MaxBlockSizeBytes = 104857600 // 100MB

// BlockPartSizeBytes is the size of one block part.
BlockPartSizeBytes = 65536 // 64kB
BlockPartSizeBytes = 1024 * 1024 // 1MB
)

// ConsensusParams contains consensus critical parameters that determine the
Expand Down Expand Up @@ -43,7 +43,7 @@ func DefaultConsensusParams() *ConsensusParams {
// DefaultBlockSize returns a default BlockSize.
func DefaultBlockSize() BlockSize {
return BlockSize{
MaxBytes: 22020096, // 21MB
MaxBytes: 1024 * 1024, // 1M
MaxGas: -1,
}
}
Expand Down

0 comments on commit 759be18

Please sign in to comment.