diff --git a/types/coin.go b/types/coin.go index 68cd7062505f..e1ef4fd29545 100644 --- a/types/coin.go +++ b/types/coin.go @@ -608,7 +608,16 @@ func (coins Coins) negative() Coins { // removeZeroCoins removes all zero coins from the given coin set in-place. func removeZeroCoins(coins Coins) Coins { - result := make([]Coin, 0, len(coins)) + result := ([]Coin)(nil) + + for i := 0; i < len(coins); i++ { + if coins[i].IsZero() { + result = make([]Coin, 0, len(coins)) + break + } else if i == len(coins)-1 { + return coins + } + } for _, coin := range coins { if !coin.IsZero() {