Skip to content

Commit

Permalink
fix empty array bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Jan 3, 2024
1 parent 3692956 commit 45aee86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func liquidityPoolsForTransaction(transaction ingest.LedgerTransaction) ([]strin
}

func dedupeStrings(in []string) []string {
if len(in) <= 1 {
return in
}
sort.Strings(in)
insert := 1
for cur := 1; cur < len(in); cur++ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,9 @@ func (operation *transactionOperationWrapper) Participants() ([]xdr.AccountId, e

// dedupeParticipants remove any duplicate ids from `in`
func dedupeParticipants(in []xdr.AccountId) []xdr.AccountId {
if len(in) <= 1 {
return in
}
sort.Slice(in, func(i, j int) bool {
return in[i].Address() < in[j].Address()
})
Expand Down

0 comments on commit 45aee86

Please sign in to comment.