fix(dao): challenger and challengee can be empty

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2024-11-19 14:52:17 +01:00
parent 190f24a10b
commit 29b20e4392
No known key found for this signature in database
GPG Key ID: E0A8F9AD733499A7

View File

@ -73,7 +73,13 @@ func (k msgServer) clearUnresolvedClaims(ctx sdk.Context, start int64) (err erro
totalAmounts := make(map[string]uint64)
for participantAddress := range currentAmounts {
stagedBalance := k.bankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(participantAddress), k.GetParams(ctx).StagedDenom)
// the challenger and challengee can be empty
participantAddressHex, err := sdk.AccAddressFromBech32(participantAddress)
if err != nil {
// try to convert as many claims as possible
continue
}
stagedBalance := k.bankKeeper.GetBalance(ctx, participantAddressHex, k.GetParams(ctx).StagedDenom)
totalAmounts[participantAddress] = stagedBalance.Amount.Uint64()
}
@ -150,7 +156,8 @@ func (k msgServer) convertOrderedClaim(ctx sdk.Context, claims map[string]uint64
for _, accountAddress := range keys {
err = k.convertAccountClaim(ctx, accountAddress, claims[accountAddress])
if err != nil {
return err
// try to convert as many claims as possible
continue
}
}