Skip to content

Commit

Permalink
cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed Feb 10, 2023
1 parent aae35ee commit b32b0f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions packages/relayer/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func Run(
}()

if !httpOnly {
indexers, closeFunc, err := makeIndexers(layer, db, profitableOnly, l1EthClient, l2EthClient)
indexers, closeFunc, err := makeIndexers(layer, db, profitableOnly)
if err != nil {
sqlDB.Close()
log.Fatal(err)
Expand All @@ -137,8 +137,6 @@ func makeIndexers(
layer relayer.Layer,
db relayer.DB,
profitableOnly relayer.ProfitableOnly,
l1EthClient *ethclient.Client,
l2EthClient *ethclient.Client,
) ([]*indexer.Service, func(), error) {
eventRepository, err := repo.NewEventRepository(db)
if err != nil {
Expand Down Expand Up @@ -179,6 +177,16 @@ func makeIndexers(
confirmations = defaultConfirmations
}

l1EthClient, err := ethclient.Dial(os.Getenv("L1_RPC_URL"))
if err != nil {
log.Fatal(err)
}

l2EthClient, err := ethclient.Dial(os.Getenv("L2_RPC_URL"))
if err != nil {
log.Fatal(err)
}

l1RpcClient, err := rpc.DialContext(context.Background(), os.Getenv("L1_RPC_URL"))
if err != nil {
return nil, nil, err
Expand Down
2 changes: 1 addition & 1 deletion packages/relayer/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func Test_makeIndexers(t *testing.T) {
defer reset()
}

indexers, cancel, err := makeIndexers(tt.layer, tt.dbFunc(t), relayer.ProfitableOnly(true), nil, nil)
indexers, cancel, err := makeIndexers(tt.layer, tt.dbFunc(t), relayer.ProfitableOnly(true))
if cancel != nil {
defer cancel()
}
Expand Down

0 comments on commit b32b0f8

Please sign in to comment.