Fix timing issue of txgen

pull/165/head
Rongjian Lan 6 years ago
parent b5ae67c8fd
commit a181f0ec70
  1. 8
      node/node_handler.go

@ -333,6 +333,7 @@ func (node *Node) WaitForConsensusReadyAccount(readySignal chan struct{}) {
node.log.Debug("Waiting for Consensus ready", "node", node) node.log.Debug("Waiting for Consensus ready", "node", node)
time.Sleep(15 * time.Second) time.Sleep(15 * time.Second)
firstTime := true
var newBlock *types.Block var newBlock *types.Block
timeoutCount := 0 timeoutCount := 0
for { // keep waiting for Consensus ready for { // keep waiting for Consensus ready
@ -349,7 +350,12 @@ func (node *Node) WaitForConsensusReadyAccount(readySignal chan struct{}) {
if !retry { if !retry {
for { for {
if len(node.pendingTransactionsAccount) >= 1 { threshold := 1
if firstTime {
threshold = 2
firstTime = false
}
if len(node.pendingTransactionsAccount) >= threshold {
// Normal tx block consensus // Normal tx block consensus
selectedTxs, _ := node.getTransactionsForNewBlockAccount(MaxNumberOfTransactionsPerBlock) selectedTxs, _ := node.getTransactionsForNewBlockAccount(MaxNumberOfTransactionsPerBlock)
node.Worker.CommitTransactions(selectedTxs) node.Worker.CommitTransactions(selectedTxs)

Loading…
Cancel
Save