From cb207f2a08ca8b88bb47cd125ae1be822891515f Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Fri, 21 Jun 2019 23:20:01 -0700 Subject: [PATCH] Fix mistakes --- core/state/statedb_test.go | 5 +++-- node/node_handler.go | 2 +- node/node_newblock.go | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index edcae241d..b17e1fc31 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -33,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethdb" "github.com/harmony-one/harmony/core/types" + common2 "github.com/harmony-one/harmony/internal/common" ) // Tests that updating a state trie does not leak any database writes prior to @@ -280,7 +281,7 @@ func newTestAction(addr common.Address, r *rand.Rand) testAction { action := actions[r.Intn(len(actions))] var nameargs []string if !action.noAddr { - nameargs = append(nameargs, addr.Hex()) + nameargs = append(nameargs, common2.MustAddressToBech32(addr)) } for _, i := range action.args { action.args[i] = rand.Int63n(100) @@ -366,7 +367,7 @@ func (test *snapshotTest) checkEqual(state, checkstate *DB) error { var err error checkeq := func(op string, a, b interface{}) bool { if err == nil && !reflect.DeepEqual(a, b) { - err = fmt.Errorf("got %s(%s) == %v, want %v", op, addr.Hex(), a, b) + err = fmt.Errorf("got %s(%s) == %v, want %v", op, common2.MustAddressToBech32(addr), a, b) return false } return true diff --git a/node/node_handler.go b/node/node_handler.go index 1767a5e77..24eecdbe3 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -47,7 +47,7 @@ import ( const ( // MaxNumberOfTransactionsPerBlock is the max number of transaction per a block. - MaxNumberOfTransactionsPerBlock = 8000 // Disable tx processing + MaxNumberOfTransactionsPerBlock = 8000 consensusTimeout = 30 * time.Second ) diff --git a/node/node_newblock.go b/node/node_newblock.go index c10fba00a..dca5a480e 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -9,6 +9,7 @@ import ( "github.com/harmony-one/harmony/core" "github.com/harmony-one/harmony/core/types" + nodeconfig "github.com/harmony-one/harmony/internal/configs/node" "github.com/harmony-one/harmony/internal/ctxerror" "github.com/harmony-one/harmony/internal/utils" ) @@ -74,7 +75,10 @@ func (node *Node) WaitForConsensusReadyv2(readySignal chan struct{}, stopChan ch coinbase := node.Consensus.SelfAddress // Normal tx block consensus - selectedTxs := node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock, coinbase) + selectedTxs := types.Transactions{} // Empty transaction list + if node.NodeConfig.GetNetworkType() != nodeconfig.Mainnet { + selectedTxs = node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock, coinbase) + } utils.GetLogInstance().Info("PROPOSING NEW BLOCK ------------------------------------------------", "blockNum", node.Blockchain().CurrentBlock().NumberU64()+1, "threshold", threshold, "selectedTxs", len(selectedTxs)) if err := node.Worker.CommitTransactions(selectedTxs, coinbase); err != nil { ctxerror.Log15(utils.GetLogger().Error,