Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update GetHeight function to return 0 when height is not defined in the payload #58

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading