Skip to content

Commit

Permalink
ContainsDenomsOf -> DenomsSubsetOf
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Treglia committed Mar 11, 2019
1 parent 38fde7d commit 3049862
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions types/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,16 @@ func (coins Coins) safeAdd(coinsB Coins) Coins {
}
}

// ContainsDenomsOf returns true if coinsB' denom set
// DenomsSubsetOf returns true if coinsB' denom set
// is subset of the receiver's denoms.
func (coins Coins) ContainsDenomsOf(coinsB Coins) bool {
func (coins Coins) DenomsSubsetOf(coinsB Coins) bool {
// more denoms in B than in receiver
if len(coinsB) > len(coins) {
if len(coins) > len(coinsB) {
return false
}

for _, coinB := range coinsB {
if coins.AmountOf(coinB.Denom).IsZero() {
for _, coin := range coins {
if coinsB.AmountOf(coin.Denom).IsZero() {
return false
}
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func (coins Coins) IsAllGT(coinsB Coins) bool {
return true
}

if !coins.ContainsDenomsOf(coinsB) {
if !coinsB.DenomsSubsetOf(coins) {
return false
}

Expand Down

0 comments on commit 3049862

Please sign in to comment.