Skip to content

Commit

Permalink
getBlockHash
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawliet-Chan committed Aug 8, 2023
1 parent c62e1d6 commit 7cdbc6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/context/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7cdbc6f

Please sign in to comment.