github.com/turingchain2020/turingchain@v1.1.21/system/p2p/dht/protocol/broadcast/const.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package broadcast
     6  
     7  import "errors"
     8  
     9  //TTL
    10  const (
    11  	// 默认交易开始哈希广播发送的ttl, 首发为1
    12  	defaultLtTxBroadCastTTL = 3
    13  	// 默认交易最大的广播发送ttl, 大于该值不再向外发送
    14  	defaultMaxTxBroadCastTTL = 25
    15  	// 默认最小区块轻广播的大小, 100KB
    16  	defaultMinLtBlockSize = 100
    17  	// 默认轻广播组装临时区块缓存, 50M
    18  	defaultLtBlockCacheSize = 50
    19  )
    20  
    21  // P2pCacheTxSize p2pcache size of transaction
    22  const (
    23  	//接收的交易哈希过滤缓存设为mempool最大接收交易量
    24  	txRecvFilterCacheNum    = 10240
    25  	blockRecvFilterCacheNum = 1024
    26  	//发送过滤主要用于发送时冗余检测, 发送完即可以被删除, 维护较小缓存数
    27  	txSendFilterCacheNum    = 500
    28  	blockSendFilterCacheNum = 50
    29  	ltBlockCacheNum         = 1000
    30  )
    31  
    32  // 内部自定义错误
    33  var (
    34  	errQueryMempool     = errors.New("errQueryMempool")
    35  	errQueryBlockChain  = errors.New("errQueryBlockChain")
    36  	errRecvBlockChain   = errors.New("errRecvBlockChain")
    37  	errRecvMempool      = errors.New("errRecvMempool")
    38  	errSendPeer         = errors.New("errSendPeer")
    39  	errSendBlockChain   = errors.New("errSendBlockChain")
    40  	errBuildBlockFailed = errors.New("errBuildBlockFailed")
    41  	errLtBlockNotExist  = errors.New("errLtBlockNotExist")
    42  )
    43  
    44  // 常量字符串
    45  
    46  const (
    47  	bcTopic      = "broadcast"
    48  	broadcastTag = "broadcast-tag"
    49  )
    50  
    51  // pubsub error
    52  var (
    53  	errSnappyDecode = errors.New("errSnappyDecode")
    54  )