diff options
author | StephenButtolph <[email protected]> | 2020-08-13 01:22:15 -0400 |
---|---|---|
committer | StephenButtolph <[email protected]> | 2020-08-13 01:22:15 -0400 |
commit | 9616c7265c06952530674fdbc193c824e099c2c4 (patch) | |
tree | 1b70274889fce327b9c470d415a5eaf4178a6298 | |
parent | 4676ebb4aca5464e9ecba47f9db7e63593e92a0e (diff) |
fixed parent block nil pointerv0.2.8-rc.5
-rw-r--r-- | plugin/evm/block.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugin/evm/block.go b/plugin/evm/block.go index 2912d2c..80c03a2 100644 --- a/plugin/evm/block.go +++ b/plugin/evm/block.go @@ -12,6 +12,7 @@ import ( "github.com/ava-labs/gecko/ids" "github.com/ava-labs/gecko/snow/choices" "github.com/ava-labs/gecko/snow/consensus/snowman" + "github.com/ava-labs/gecko/vms/components/missing" ) // Block implements the snowman.Block interface @@ -50,9 +51,12 @@ func (b *Block) Status() choices.Status { // Parent implements the snowman.Block interface func (b *Block) Parent() snowman.Block { parentID := ids.NewID(b.ethBlock.ParentHash()) - block := b.vm.getBlock(parentID) - b.vm.ctx.Log.Verbo("Parent(%s) has status: %s", block.ID(), block.Status()) - return block + if block := b.vm.getBlock(parentID); block != nil { + b.vm.ctx.Log.Verbo("Parent(%s) has status: %s", parentID, block.Status()) + return block + } + b.vm.ctx.Log.Verbo("Parent(%s) has status: %s", parentID, choices.Unknown) + return &missing.Block{BlkID: parentID} } // Verify implements the snowman.Block interface |