Commit db0e18c9 authored by Will Cory's avatar Will Cory Committed by GitHub

Merge pull request #6767 from ethereum-optimism/08-12-feat_indexer_Preallocate_space_for_a_slice_

feat(indexer): Preallocate space for a slice
parents 6c349fa3 6f87ca84
...@@ -30,7 +30,7 @@ type DepositResponse struct { ...@@ -30,7 +30,7 @@ type DepositResponse struct {
// TODO this is original spec but maybe include the l2 block info too for the relayed tx // TODO this is original spec but maybe include the l2 block info too for the relayed tx
// FIXME make a pure function that returns a struct instead of newWithdrawalResponse // FIXME make a pure function that returns a struct instead of newWithdrawalResponse
func newDepositResponse(deposits []*database.L1BridgeDepositWithTransactionHashes) DepositResponse { func newDepositResponse(deposits []*database.L1BridgeDepositWithTransactionHashes) DepositResponse {
var items []DepositItem items := make([]DepositItem, len(deposits))
for _, deposit := range deposits { for _, deposit := range deposits {
item := DepositItem{ item := DepositItem{
Guid: deposit.L1BridgeDeposit.TransactionSourceHash.String(), Guid: deposit.L1BridgeDeposit.TransactionSourceHash.String(),
......
...@@ -43,7 +43,7 @@ type WithdrawalResponse struct { ...@@ -43,7 +43,7 @@ type WithdrawalResponse struct {
// FIXME make a pure function that returns a struct instead of newWithdrawalResponse // FIXME make a pure function that returns a struct instead of newWithdrawalResponse
func newWithdrawalResponse(withdrawals []*database.L2BridgeWithdrawalWithTransactionHashes) WithdrawalResponse { func newWithdrawalResponse(withdrawals []*database.L2BridgeWithdrawalWithTransactionHashes) WithdrawalResponse {
var items []WithdrawalItem items := make([]WithdrawalItem, len(withdrawals))
for _, withdrawal := range withdrawals { for _, withdrawal := range withdrawals {
item := WithdrawalItem{ item := WithdrawalItem{
Guid: withdrawal.L2BridgeWithdrawal.TransactionWithdrawalHash.String(), Guid: withdrawal.L2BridgeWithdrawal.TransactionWithdrawalHash.String(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment