From 78d1a52fd9d8457d4c1e7f7082259b0baf08980c Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Mon, 15 Jul 2019 22:20:49 -0700 Subject: [PATCH] move Update out of Select Transaction --- node/node_newblock.go | 3 +++ node/worker/worker.go | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/node/node_newblock.go b/node/node_newblock.go index 973be6564..29ab7e153 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -63,6 +63,9 @@ func (node *Node) WaitForConsensusReadyv2(readySignal chan struct{}, stopChan ch selectedTxs := types.Transactions{} // Empty transaction list if node.NodeConfig.GetNetworkType() != nodeconfig.Mainnet { selectedTxs = node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock, coinbase) + if err := node.Worker.UpdateCurrent(coinbase); err != nil { + utils.GetLogger().Error("Failed updating worker's state", "Error", err) + } } utils.GetLogInstance().Info("PROPOSING NEW BLOCK ------------------------------------------------", "blockNum", node.Blockchain().CurrentBlock().NumberU64()+1, "selectedTxs", len(selectedTxs)) if err := node.Worker.CommitTransactions(selectedTxs, coinbase); err != nil { diff --git a/node/worker/worker.go b/node/worker/worker.go index 9782487a3..5b2e995b0 100644 --- a/node/worker/worker.go +++ b/node/worker/worker.go @@ -67,9 +67,6 @@ func (w *Worker) SelectTransactionsForNewBlock(txs types.Transactions, maxNumTxs } } } - if err := w.UpdateCurrent(coinbase); err != nil { - utils.GetLogger().Error("Failed updating worker's state", "Error", err) - } return selected, unselected, invalid }