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
929077b1
Commit
929077b1
authored
Mar 17, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stash txmgr changes
parent
1b797f2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
txmgr.go
op-service/txmgr/txmgr.go
+8
-1
No files found.
op-service/txmgr/txmgr.go
View file @
929077b1
...
...
@@ -101,6 +101,8 @@ type ETHBackend interface {
// TODO(CLI-3318): Maybe need a generic interface to support different RPC providers
HeaderByNumber
(
ctx
context
.
Context
,
number
*
big
.
Int
)
(
*
types
.
Header
,
error
)
SuggestGasTipCap
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
// NonceAt returns the account nonce of the given account.
// The block number can be nil, in which case the nonce is taken from the latest known block.
NonceAt
(
ctx
context
.
Context
,
account
common
.
Address
,
blockNumber
*
big
.
Int
)
(
uint64
,
error
)
}
...
...
@@ -166,6 +168,7 @@ func (m *SimpleTxManager) CraftTx(ctx context.Context, candidate TxCandidate) (*
return
nil
,
err
}
// Fetch the sender's nonce from the latest known block (nil `blockNumber`)
childCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
m
.
Config
.
NetworkTimeout
)
nonce
,
err
:=
m
.
backend
.
NonceAt
(
childCtx
,
candidate
.
From
,
nil
)
cancel
()
...
...
@@ -181,8 +184,9 @@ func (m *SimpleTxManager) CraftTx(ctx context.Context, candidate TxCandidate) (*
GasFeeCap
:
gasFeeCap
,
Data
:
candidate
.
TxData
,
}
m
.
l
.
Info
(
"creating tx"
,
"to"
,
rawTx
.
To
,
"from"
,
candidate
.
From
)
// Calculate the intrinsic gas for the transaction
m
.
l
.
Info
(
"creating tx"
,
"to"
,
rawTx
.
To
,
"from"
,
candidate
.
From
)
gas
,
err
:=
core
.
IntrinsicGas
(
rawTx
.
Data
,
nil
,
false
,
true
,
true
,
false
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to calculate intrinsic gas: %w"
,
err
)
...
...
@@ -278,6 +282,9 @@ func NewSimpleTxManager(name string, l log.Logger, cfg Config, backend ETHBacken
if
cfg
.
NumConfirmations
==
0
{
panic
(
"txmgr: NumConfirmations cannot be zero"
)
}
if
cfg
.
NetworkTimeout
==
0
{
cfg
.
NetworkTimeout
=
2
*
time
.
Second
}
return
&
SimpleTxManager
{
name
:
name
,
...
...
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