diff --git a/core/context/read.go b/core/context/read.go index f9627bc2..9d0ff485 100644 --- a/core/context/read.go +++ b/core/context/read.go @@ -17,8 +17,13 @@ func NewReadContext(ctx *gin.Context) (*ReadContext, error) { }, nil } -func (rc *ReadContext) GetBlockHash() common.Hash { - return common.HexToHash(rc.Query(core.BlockHashKey)) +func (rc *ReadContext) GetBlockHash() *common.Hash { + blockHashHex := rc.Query(core.BlockHashKey) + if blockHashHex == "" { + return nil + } + blockHash := common.HexToHash(blockHashHex) + return &blockHash } func (rc *ReadContext) JsonOk(v any) {