Skip to content

Commit

Permalink
Merge pull request #2136 from vegaprotocol/bugfix/2122-filter-by-mark…
Browse files Browse the repository at this point in the history
…et-id-liquidity-infra

storage market accounts, do not stop loadinng account after asset match
  • Loading branch information
edd authored Aug 26, 2020
2 parents 320357f + 0d26586 commit 09c9f17
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion storage/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ func (a *Account) GetMarketAccounts(marketID, asset string) ([]*types.Account, e
return accs, nil
}

// for the market account as we were looking only for the insurance pool account,
// although we added the Liquidity fee account, which also need to be returned,
// if we were breaking after we find the first account with matching asset.
out := []*types.Account{}
for _, v := range accs {
if asset == v.Asset {
out = append(out, v)
break
}
}

Expand All @@ -126,6 +128,9 @@ func (a *Account) GetFeeInfrastructureAccounts(asset string) ([]*types.Account,
return accs, nil
}

// in the case of the infrastructure fee account we will get one infrastructure fee account per asset only,
// the early exit makes sense there as as soon as we find the account for the required asset,
// we know it's the only one
out := []*types.Account{}
for _, v := range accs {
if asset == v.Asset {
Expand Down

0 comments on commit 09c9f17

Please sign in to comment.