Fix mistakes

pull/1133/head
Rongjian Lan 6 years ago
parent bcd89eff8c
commit cb207f2a08
  1. 5
      core/state/statedb_test.go
  2. 2
      node/node_handler.go
  3. 6
      node/node_newblock.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

@ -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
)

@ -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,

Loading…
Cancel
Save