Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Kelp GUI: do not attempt to add trustlines for assets created by trad…
Browse files Browse the repository at this point in the history
…ing account
  • Loading branch information
nikhilsaraf committed Apr 27, 2020
1 parent 3dfb14a commit 9fd7afc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gui/backend/upsert_bot_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,18 @@ func (s *APIServer) checkAddTrustline(account hProtocol.Account, kp keypair.KP,
client = s.apiTestNet
}

address := kp.Address()
// find trustlines to be added
trustlines := []hProtocol.Asset{}
for _, a := range assets {
if a.Type == "native" {
log.Printf("not adding a trustline for the native asset\n")
continue
}
if a.Issuer == address {
log.Printf("not adding a trustline for an asset created by this trading account\n")
continue
}

found := false
// inefficient to have a double for-loop but ok since there will only ever be two assets in the list
Expand All @@ -261,7 +266,6 @@ func (s *APIServer) checkAddTrustline(account hProtocol.Account, kp keypair.KP,
}

// build txn
address := kp.Address()
accountReq := horizonclient.AccountRequest{AccountID: address}
account, err := client.AccountDetail(accountReq)
if err != nil {
Expand Down

0 comments on commit 9fd7afc

Please sign in to comment.