Add sanity checks
This commit is contained in:
@@ -40,6 +40,10 @@ func SimulateDeductFee(m auth.AccountMapper, f auth.FeeCollectionKeeper) simulat
|
||||
panic(err)
|
||||
}
|
||||
m.SetAccount(ctx, stored)
|
||||
if !coins.IsNotNegative() {
|
||||
panic("setting negative fees")
|
||||
}
|
||||
|
||||
f.AddCollectedFees(ctx, coins)
|
||||
|
||||
event(fmt.Sprintf("auth/SimulateDeductFee/true"))
|
||||
|
||||
@@ -45,6 +45,9 @@ func (vi ValidatorDistInfo) TakeFeePoolRewards(fp FeePool, height int64, totalBo
|
||||
blocks := height - vi.FeePoolWithdrawalHeight
|
||||
vi.FeePoolWithdrawalHeight = height
|
||||
accum := vdTokens.MulInt(sdk.NewInt(blocks))
|
||||
if accum.GT(fp.ValAccum.Accum) {
|
||||
panic("individual accum should never be greater than the total")
|
||||
}
|
||||
withdrawalTokens := fp.Pool.MulDec(accum).QuoDec(fp.ValAccum.Accum)
|
||||
remainingTokens := fp.Pool.Minus(withdrawalTokens)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user