Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
7c439edf
Unverified
Commit
7c439edf
authored
Jan 18, 2022
by
Javed Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: dial sequencer client with timeout
parent
ab8223d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
api.go
l2geth/internal/ethapi/api.go
+19
-1
No files found.
l2geth/internal/ethapi/api.go
View file @
7c439edf
...
@@ -52,6 +52,12 @@ import (
...
@@ -52,6 +52,12 @@ import (
var
errOVMUnsupported
=
errors
.
New
(
"OVM: Unsupported RPC Method"
)
var
errOVMUnsupported
=
errors
.
New
(
"OVM: Unsupported RPC Method"
)
const
(
// defaultDialTimeout is default duration the service will wait on
// startup to make a connection to either the L1 or L2 backends.
defaultDialTimeout
=
5
*
time
.
Second
)
// PublicEthereumAPI provides an API to access Ethereum related information.
// PublicEthereumAPI provides an API to access Ethereum related information.
// It offers only methods that operate on public data that is freely available to anyone.
// It offers only methods that operate on public data that is freely available to anyone.
type
PublicEthereumAPI
struct
{
type
PublicEthereumAPI
struct
{
...
@@ -1290,6 +1296,18 @@ func newRPCTransactionFromBlockHash(b *types.Block, hash common.Hash) *RPCTransa
...
@@ -1290,6 +1296,18 @@ func newRPCTransactionFromBlockHash(b *types.Block, hash common.Hash) *RPCTransa
return
nil
return
nil
}
}
// dialSequencerClientWithTimeout attempts to dial the Sequencer using the
// provided URL. If the dial doesn't complete within defaultDialTimeout
// seconds, this method will return an error.
func
dialSequencerClientWithTimeout
(
ctx
context
.
Context
,
url
string
)
(
*
ethclient
.
Client
,
error
)
{
ctxt
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultDialTimeout
)
defer
cancel
()
return
ethclient
.
DialContext
(
ctxt
,
url
)
}
// PublicTransactionPoolAPI exposes methods for the RPC interface
// PublicTransactionPoolAPI exposes methods for the RPC interface
type
PublicTransactionPoolAPI
struct
{
type
PublicTransactionPoolAPI
struct
{
b
Backend
b
Backend
...
@@ -1660,7 +1678,7 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod
...
@@ -1660,7 +1678,7 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod
}
}
if
s
.
b
.
IsVerifier
()
{
if
s
.
b
.
IsVerifier
()
{
client
,
err
:=
ethclient
.
Dial
(
s
.
b
.
SequencerClientHttp
())
client
,
err
:=
dialSequencerClientWithTimeout
(
ctx
,
s
.
b
.
SequencerClientHttp
())
if
err
!=
nil
{
if
err
!=
nil
{
return
common
.
Hash
{},
err
return
common
.
Hash
{},
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment