Merge PR #3625: Fix Fee Comparison

This commit is contained in:
Alexander Bezobchuk 2019-02-12 10:22:04 -05:00 committed by Christopher Goes
parent fa2e9b8518
commit 2216f4716e
3 changed files with 4 additions and 1 deletions

View File

@ -57,5 +57,7 @@ BUG FIXES
* SDK
* [\#3582](https://github.com/cosmos/cosmos-sdk/pull/3582) Running `make test_unit was failing due to a missing tag
* [\#3617] Fix fee comparison when the required fees does not contain any denom
present in the tx fees.
* Tendermint

View File

@ -311,7 +311,7 @@ func (coins Coins) IsAnyGTE(coinsB Coins) bool {
for _, coin := range coins {
amt := coinsB.AmountOf(coin.Denom)
if coin.Amount.GTE(amt) {
if coin.Amount.GTE(amt) && !amt.IsZero() {
return true
}
}

View File

@ -517,6 +517,7 @@ func TestCoinsIsAnyGTE(t *testing.T) {
assert.False(t, Coins{{"a", one}}.IsAnyGTE(Coins{}))
assert.False(t, Coins{}.IsAnyGTE(Coins{{"a", one}}))
assert.False(t, Coins{{"a", one}}.IsAnyGTE(Coins{{"a", two}}))
assert.False(t, Coins{{"a", one}}.IsAnyGTE(Coins{{"b", one}}))
assert.True(t, Coins{{"a", one}, {"b", two}}.IsAnyGTE(Coins{{"a", two}, {"b", one}}))
assert.True(t, Coins{{"a", one}}.IsAnyGTE(Coins{{"a", one}}))
assert.True(t, Coins{{"a", two}}.IsAnyGTE(Coins{{"a", one}}))