min # of txs per block

pull/73/head
Minh Doan 6 years ago
parent 9e1b9129e5
commit 15db2fdb81
  1. 6
      node/node_handler.go

@ -20,6 +20,8 @@ import (
) )
const ( const (
// The min number of transaction per a block.
MinNumberOfTransactionsPerBlock = 6000
// The max number of transaction per a block. // The max number of transaction per a block.
MaxNumberOfTransactionsPerBlock = 10000 MaxNumberOfTransactionsPerBlock = 10000
// The number of blocks allowed before generating state block // The number of blocks allowed before generating state block
@ -304,11 +306,11 @@ func (node *Node) WaitForConsensusReady(readySignal chan struct{}) {
// Normal tx block consensus // Normal tx block consensus
for { for {
// Once we have pending transactions we will try creating a new block // Once we have pending transactions we will try creating a new block
if len(node.pendingTransactions) >= 1 { if len(node.pendingTransactions) >= MaxNumberOfTransactionsPerBlock {
node.log.Debug("Start selecting transactions") node.log.Debug("Start selecting transactions")
selectedTxs, crossShardTxAndProofs := node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock) selectedTxs, crossShardTxAndProofs := node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock)
if len(selectedTxs) == 0 { if len(selectedTxs)+len(crossShardTxAndProofs) < MinNumberOfTransactionsPerBlock {
node.log.Debug("No valid transactions exist", "pendingTx", len(node.pendingTransactions)) node.log.Debug("No valid transactions exist", "pendingTx", len(node.pendingTransactions))
} else { } else {
node.log.Debug("Creating new block", "numAllTxs", len(selectedTxs), "numCrossTxs", len(crossShardTxAndProofs), "pendingTxs", len(node.pendingTransactions), "currentChainSize", len(node.blockchain.Blocks)) node.log.Debug("Creating new block", "numAllTxs", len(selectedTxs), "numCrossTxs", len(crossShardTxAndProofs), "pendingTxs", len(node.pendingTransactions), "currentChainSize", len(node.blockchain.Blocks))

Loading…
Cancel
Save