Ver Fonte

catalyst: check if block exists in assemble-block call with unknown parent-hash (#22770)

Diederik Loerakker há 4 anos atrás
pai
commit
c7d07294a6
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      eth/catalyst/api.go

+ 5 - 0
eth/catalyst/api.go

@@ -109,6 +109,11 @@ func (api *consensusAPI) AssembleBlock(params assembleBlockParams) (*executableD
 
 	bc := api.eth.BlockChain()
 	parent := bc.GetBlockByHash(params.ParentHash)
+	if parent == nil {
+		log.Warn("Cannot assemble block with parent hash to unknown block", "parentHash", params.ParentHash)
+		return nil, fmt.Errorf("cannot assemble block with unknown parent %s", params.ParentHash)
+	}
+
 	pool := api.eth.TxPool()
 
 	if parent.Time() >= params.Timestamp {