Skip to content

Commit

Permalink
add TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Jun 28, 2024
1 parent 6e6b781 commit 6adf45b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/chains/chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,11 @@ func CombineDefaultChainsList(chains []Chain) []*Chain {

// CombineChainList combines a list of chains with a list of chains
// duplicated chain ID are overwritten by the second list
func CombineChainList(base []Chain, additional ...Chain) []Chain {
combined := make([]*Chain, 0, len(base) + len(additional))
combined = append(combined, chains1...)
// TODO: remove pointers
// https://github.com/zeta-chain/node/issues/2080
func CombineChainList(base []*Chain, additional []*Chain) []*Chain {
combined := make([]*Chain, 0, len(base)+len(additional))
combined = append(combined, additional...)

// map chain ID in chains1 to index in the list
chainIDIndexMap := make(map[int64]int)
Expand All @@ -402,7 +404,7 @@ func CombineChainList(base []Chain, additional ...Chain) []Chain {

// add chains2 to combined
// if chain ID already exists in chains1, overwrite it
for _, chain := range chains2 {
for _, chain := range additional {
if index, ok := chainIDIndexMap[chain.ChainId]; ok {
combined[index] = chain
} else {
Expand Down

0 comments on commit 6adf45b

Please sign in to comment.