Skip to content

Commit

Permalink
op-node: cleanup genesis generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes committed Nov 13, 2023
1 parent 9be8666 commit 713d950
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions op-node/cmd/genesis/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,27 +196,27 @@ var Subcommands = cli.Commands{
}

if l1RPC != "" {
client, err := ethclient.Dial(ctx.String("l1-rpc"))
client, err := ethclient.Dial(l1RPC)
if err != nil {
return fmt.Errorf("cannot dial %s: %w", l1RPC, err)
}

if config.L1StartingBlockTag == nil {
l1StartBlock, err = client.BlockByNumber(context.Background(), nil)
if err != nil {
return fmt.Errorf("%w", err)
return fmt.Errorf("cannot fetch latest block: %w", err)
}
tag := rpc.BlockNumberOrHashWithHash(l1StartBlock.Hash(), true)
config.L1StartingBlockTag = (*genesis.MarshalableRPCBlockNumberOrHash)(&tag)
} else if config.L1StartingBlockTag.BlockHash != nil {
l1StartBlock, err = client.BlockByHash(context.Background(), *config.L1StartingBlockTag.BlockHash)
if err != nil {
return fmt.Errorf("%w", err)
return fmt.Errorf("cannot fetch block by hash: %w", err)
}
} else if config.L1StartingBlockTag.BlockNumber != nil {
l1StartBlock, err = client.BlockByNumber(context.Background(), big.NewInt(config.L1StartingBlockTag.BlockNumber.Int64()))
if err != nil {
return fmt.Errorf("%w", err)
return fmt.Errorf("cannot fetch block by number: %w", err)
}
}
}
Expand Down

0 comments on commit 713d950

Please sign in to comment.