fix bugs with memdb + vprovider setting
- wasn't setting list of verified providers - was looping through multilevel keys, not auctionidmaster
parent
11829e1017
commit
c08c827b4e
|
@ -41,14 +41,17 @@ func (k Keeper) FinalizeExpiredAuctions(ctx sdk.Context) {
|
||||||
// Remaining Unpaid: Full bid amount
|
// Remaining Unpaid: Full bid amount
|
||||||
auction.Remaining = auction.Best.Amount
|
auction.Remaining = auction.Best.Amount
|
||||||
|
|
||||||
// clear auction
|
// clear auction bids
|
||||||
if err := memdb.AuctionDB.ClearAuctionBids(auctionId); err != nil {
|
if err := memdb.AuctionDB.ClearAuctionBids(auctionId); err != nil {
|
||||||
return errors.Errorf("failed to clear auction from memcache: %s", err)
|
return errors.Errorf("failed to clear auction from memcache: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := memdb.AuctionDB.ClearVerifiedProviders(auctionId); err != nil {
|
// clear verified provider list; swallow error since this isn't critical for now
|
||||||
return errors.Errorf("failed to clear verified providers for auction %s: %s", auctionId, err)
|
_ = memdb.AuctionDB.ClearVerifiedProviders(auctionId)
|
||||||
}
|
|
||||||
|
// if err := memdb.AuctionDB.ClearVerifiedProviders(auctionId); err != nil {
|
||||||
|
// return errors.Errorf("failed to clear verified providers for auction %s: %s", auctionId, err)
|
||||||
|
// }
|
||||||
|
|
||||||
// pay out unpaid remainder to auction creator
|
// pay out unpaid remainder to auction creator
|
||||||
ceiling := new(big.Int)
|
ceiling := new(big.Int)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"colinear/x/colinearcore/auctionconfig"
|
"colinear/x/colinearcore/auctionconfig"
|
||||||
|
"colinear/x/colinearcore/memdb"
|
||||||
"colinear/x/colinearcore/types"
|
"colinear/x/colinearcore/types"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
@ -65,6 +66,12 @@ found:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if msg.VerifiedProviders != nil {
|
||||||
|
memdb.AuctionDB.SetVerifiedProviders(index, msg.VerifiedProviders)
|
||||||
|
} else {
|
||||||
|
memdb.AuctionDB.SetVerifiedProviders(index, []string{})
|
||||||
|
}
|
||||||
|
|
||||||
auction := types.Auction{
|
auction := types.Auction{
|
||||||
Index: index,
|
Index: index,
|
||||||
Name: msg.Name,
|
Name: msg.Name,
|
||||||
|
|
|
@ -170,8 +170,9 @@ func (b *auctionDB) ForEachAuctionBidList(viewFunc func(string) error) error {
|
||||||
item := iter.Item()
|
item := iter.Item()
|
||||||
key := string(item.Key())
|
key := string(item.Key())
|
||||||
// require that this be an auction bids key
|
// require that this be an auction bids key
|
||||||
if len(key) > 5 && key[len(key)-5:len(key)-1] == "_bids" {
|
if len(key) > 5 && key[len(key)-5:] == "_bids" {
|
||||||
err := viewFunc(key)
|
auctionId := key[:len(key)-5]
|
||||||
|
err := viewFunc(auctionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue