diff --git a/indexer/xchain/in_updater.go b/indexer/xchain/in_updater.go index 4c717e5..ab8ba67 100644 --- a/indexer/xchain/in_updater.go +++ b/indexer/xchain/in_updater.go @@ -47,8 +47,8 @@ func (iu *xChainInputUpdater) updateFromDB( return nil, err } baseOuts := shared.NewOutputMap() - for _, out := range outs { - baseOuts.Add(shared.NewIdIndexKey(out.TxID, out.Index()), &out.TxOutput) + for i, out := range outs { + baseOuts.Add(shared.NewIdIndexKey(out.TxID, out.Index()), &outs[i].TxOutput) } return inputs.UpdateWithOutputs(baseOuts), nil } diff --git a/services/api/pchain.go b/services/api/pchain.go index 7f8e9d3..c87a80b 100644 --- a/services/api/pchain.go +++ b/services/api/pchain.go @@ -98,9 +98,8 @@ func newApiPChainTxListItem(tx *database.PChainTxData) ApiPChainTxListItem { func NewApiPChainTxList(txs []database.PChainTxData) []ApiPChainTxListItem { result := make([]ApiPChainTxListItem, len(txs)) - for i, tx := range txs { - result[i] = newApiPChainTxListItem(&tx) + for i := range txs { + result[i] = newApiPChainTxListItem(&txs[i]) } - return result } diff --git a/utils/structures.go b/utils/structures.go index 80b2ca6..ced3c7c 100644 --- a/utils/structures.go +++ b/utils/structures.go @@ -19,15 +19,6 @@ func ArrayToMap[T, K comparable](ts []T, kf func(T) K) map[K]T { return result } -// Create a map from array with kf providing keys, values are pointers to array elements -func ArrayToPtrMap[T, K comparable](ts []T, kf func(T) K) map[K]*T { - result := make(map[K]*T) - for _, t := range ts { - result[kf(t)] = &t - } - return result -} - func Keys[K comparable, V any](m map[K]V) []K { keys := make([]K, 0, len(m)) for k := range m {