From 3653c43619f32a7a82fccde6975037037b168248 Mon Sep 17 00:00:00 2001 From: Dennis Won Date: Fri, 9 Aug 2019 10:56:06 -0700 Subject: [PATCH] fix nil seg fault breaking consensus --- node/node.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/node/node.go b/node/node.go index 8078f6fb1..030abceb2 100644 --- a/node/node.go +++ b/node/node.go @@ -264,7 +264,7 @@ func (node *Node) getTransactionsForNewBlock(coinbase common.Address) types.Tran delete(node.recentTxsStats, blockNum) } } - node.recentTxsStats[newBlockNum] = types.BlockTxsCounts{} + node.recentTxsStats[newBlockNum] = make(types.BlockTxsCounts) selected, unselected, invalid := node.Worker.SelectTransactionsForNewBlock(newBlockNum, node.pendingTransactions, node.recentTxsStats, core.ShardingSchedule.TxsThrottleConfig(), coinbase) @@ -344,6 +344,7 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, chainDBFactory shardc node.ConfirmedBlockChannel = make(chan *types.Block) node.BeaconBlockChannel = make(chan *types.Block) + node.recentTxsStats = make(types.RecentTxsStats) node.TxPool = core.NewTxPool(core.DefaultTxPoolConfig, node.Blockchain().Config(), chain) node.Worker = worker.New(node.Blockchain().Config(), chain, node.Consensus, node.Consensus.ShardID)