Skip to content

Commit

Permalink
fix: update GetHeight function to return 0 when height is not defined…
Browse files Browse the repository at this point in the history
… in the payload (#58)
  • Loading branch information
akhlopiachyi authored Feb 20, 2024
1 parent 49f6755 commit 4bbf157
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions modules/actions/types/handler.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package types

import (
"fmt"

"github.com/forbole/juno/v5/node"

modulestypes "github.com/forbole/bdjuno/v4/modules/types"
Expand All @@ -25,11 +23,7 @@ func NewContext(node node.Node, sources *modulestypes.Sources) *Context {
// GetHeight uses the lastest height when the input height is empty from graphql request
func (c *Context) GetHeight(payload *Payload) (int64, error) {
if payload == nil || payload.Input.Height == 0 {
latestHeight, err := c.node.LatestHeight()
if err != nil {
return 0, fmt.Errorf("error while getting chain latest block height: %s", err)
}
return latestHeight, nil
return 0, nil
}

return payload.Input.Height, nil
Expand Down

0 comments on commit 4bbf157

Please sign in to comment.