Skip to content

Commit

Permalink
fix: query outtx tracker by chain using prefixed store (#1283)
Browse files Browse the repository at this point in the history
* query outtx tracker by chain using prefixed store

* query outtx tracker by chain using prefixed store

---------

Co-authored-by: charliec <[email protected]>
Co-authored-by: Lucas Bertrand <[email protected]>
  • Loading branch information
3 people authored Oct 14, 2023
1 parent d31b61c commit fb82095
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions x/crosschain/keeper/keeper_out_tx_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,15 @@ func (k Keeper) OutTxTrackerAllByChain(c context.Context, req *types.QueryAllOut
var outTxTrackers []types.OutTxTracker
ctx := sdk.UnwrapSDKContext(c)

store := ctx.KVStore(k.storeKey)
outTxTrackerStore := prefix.NewStore(store, types.KeyPrefix(types.OutTxTrackerKeyPrefix))
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix))
chainStore := prefix.NewStore(store, types.KeyPrefix(fmt.Sprintf("%d-", req.Chain)))

pageRes, err := query.Paginate(outTxTrackerStore, req.Pagination, func(key []byte, value []byte) error {
pageRes, err := query.Paginate(chainStore, req.Pagination, func(key []byte, value []byte) error {
var outTxTracker types.OutTxTracker
if err := k.cdc.Unmarshal(value, &outTxTracker); err != nil {
return err
}
if outTxTracker.ChainId == req.Chain {
outTxTrackers = append(outTxTrackers, outTxTracker)
}
outTxTrackers = append(outTxTrackers, outTxTracker)
return nil
})

Expand Down

0 comments on commit fb82095

Please sign in to comment.