Skip to content

Commit

Permalink
Add custom sync method only for lean pokt
Browse files Browse the repository at this point in the history
  • Loading branch information
poktblade committed Jun 27, 2022
1 parent 435562a commit 5bd0f61
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions app/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,13 +525,14 @@ func (app PocketCoreApp) HandleRelay(r pocketTypes.Relay) (res *pocketTypes.Rela
return nil, nil, err
}

status, err := app.pocketKeeper.TmNode.Synced()

if !status.IsSynced {
return nil, nil, fmt.Errorf("pocket node is currently syncing to the blockchain, cannot service in this state")
}

if GlobalConfig.PocketConfig.LeanPocket {
status, sErr := app.pocketKeeper.TmNode.Synced()
if sErr != nil {
return nil, nil, fmt.Errorf("pocket node is unable to retrieve status from tendermint node, cannot service in this state")
}
if !status.IsSynced {
return nil, nil, fmt.Errorf("pocket node is currently syncing to the blockchain, cannot service in this state")
}
res, err = app.pocketKeeper.HandleRelayLean(ctx, r)
if err != nil && pocketTypes.ErrorWarrantsDispatch(err) {

Expand All @@ -549,6 +550,13 @@ func (app PocketCoreApp) HandleRelay(r pocketTypes.Relay) (res *pocketTypes.Rela
}
}
} else {
status, sErr := app.pocketKeeper.TmNode.Status()
if sErr != nil {
return nil, nil, fmt.Errorf("pocket node is unable to retrieve status from tendermint node, cannot service in this state")
}
if status.SyncInfo.CatchingUp {
return nil, nil, fmt.Errorf("pocket node is currently syncing to the blockchain, cannot service in this state")
}
res, err = app.pocketKeeper.HandleRelay(ctx, r)
var err1 error
if err != nil && pocketTypes.ErrorWarrantsDispatch(err) {
Expand Down

0 comments on commit 5bd0f61

Please sign in to comment.