fix a nil pointer issue cased program crash

Signed-off-by: Leo Chen <leo@harmony.one>
pull/465/head
Leo Chen 6 years ago
parent 57ee1d6018
commit 464527a99a
  1. 2
      node/node.go
  2. 1
      node/node_handler.go

@ -654,7 +654,7 @@ func (node *Node) UpdateStakingList(block *types.Block) error {
for i := range txns {
txn := txns[i]
toAddress := txn.To()
if *toAddress != node.StakingContractAddress { //Not a address aimed at the staking contract.
if toAddress != nil && *toAddress != node.StakingContractAddress { //Not a address aimed at the staking contract.
continue
}
currentSender, _ := types.Sender(signerType, txn)

@ -258,6 +258,7 @@ func (node *Node) VerifyNewBlock(newBlock *types.Block) bool {
// 2. [leader] send new block to the client
func (node *Node) PostConsensusProcessing(newBlock *types.Block) {
if node.Role == BeaconLeader || node.Role == BeaconValidator {
utils.GetLogInstance().Info("PostConsensusProcessing", "newBlock", newBlock)
node.UpdateStakingList(newBlock)
}
if node.Consensus.IsLeader {

Loading…
Cancel
Save