Fix auctions iteration
This commit is contained in:
parent
332fa8da37
commit
30a88790f2
@ -217,17 +217,17 @@ func (k Keeper) ListAuctions(ctx sdk.Context) ([]auctiontypes.Auction, error) {
|
|||||||
func (k Keeper) MatchAuctions(ctx sdk.Context, matchFn func(*auctiontypes.Auction) (bool, error)) ([]*auctiontypes.Auction, error) {
|
func (k Keeper) MatchAuctions(ctx sdk.Context, matchFn func(*auctiontypes.Auction) (bool, error)) ([]*auctiontypes.Auction, error) {
|
||||||
var auctions []*auctiontypes.Auction
|
var auctions []*auctiontypes.Auction
|
||||||
|
|
||||||
err := k.Auctions.Walk(ctx, nil, func(key string, value auctiontypes.Auction) (stop bool, err error) {
|
err := k.Auctions.Walk(ctx, nil, func(key string, value auctiontypes.Auction) (bool, error) {
|
||||||
auctionMatched, err := matchFn(&value)
|
auctionMatched, err := matchFn(&value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return true, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if auctionMatched {
|
if auctionMatched {
|
||||||
auctions = append(auctions, &value)
|
auctions = append(auctions, &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
return false, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -532,10 +532,8 @@ func (k Keeper) GetAuctionModuleBalances(ctx sdk.Context) sdk.Coins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (k Keeper) EndBlockerProcessAuctions(ctx sdk.Context) error {
|
func (k Keeper) EndBlockerProcessAuctions(ctx sdk.Context) error {
|
||||||
var err error
|
|
||||||
|
|
||||||
// Transition auction state (commit, reveal, expired, completed).
|
// Transition auction state (commit, reveal, expired, completed).
|
||||||
if err = k.processAuctionPhases(ctx); err != nil {
|
if err := k.processAuctionPhases(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user