Do not proceed if no tx in block

pull/177/head
Rongjian Lan 6 years ago
parent c7efda6d89
commit 4e97b3b595
  1. 16
      node/node_handler.go

@ -232,13 +232,15 @@ func (node *Node) WaitForConsensusReady(readySignal chan struct{}) {
if len(node.pendingTransactions) >= threshold {
// Normal tx block consensus
selectedTxs := node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock)
node.Worker.CommitTransactions(selectedTxs)
block, err := node.Worker.Commit()
if err != nil {
node.log.Debug("Failed commiting new block", "Error", err)
} else {
newBlock = block
break
if len(selectedTxs) != 0 {
node.Worker.CommitTransactions(selectedTxs)
block, err := node.Worker.Commit()
if err != nil {
node.log.Debug("Failed commiting new block", "Error", err)
} else {
newBlock = block
break
}
}
}
// If not enough transactions to run Consensus,

Loading…
Cancel
Save