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
a291745d
Unverified
Commit
a291745d
authored
Nov 24, 2021
by
Conner Fromknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: create commitTransactionsWithError for commiting sequencer txs
parent
d27252b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
worker.go
l2geth/miner/worker.go
+26
-5
No files found.
l2geth/miner/worker.go
View file @
a291745d
...
...
@@ -77,6 +77,16 @@ const (
staleThreshold
=
7
)
var
(
// ErrCannotCommitTxn signals that the transaction execution failed
// when attempting to mine a transaction.
//
// NOTE: This error is not expected to occur in regular operation of
// l2geth, rather the actual execution error should be returned to the
// user.
ErrCannotCommitTxn
=
errors
.
New
(
"Cannot commit transaction in miner"
)
)
// environment is the worker's current environment and holds all of the current state information.
type
environment
struct
{
signer
types
.
Signer
...
...
@@ -773,9 +783,13 @@ func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Addres
}
func
(
w
*
worker
)
commitTransactions
(
txs
*
types
.
TransactionsByPriceAndNonce
,
coinbase
common
.
Address
,
interrupt
*
int32
)
bool
{
return
w
.
commitTransactionsWithError
(
txs
,
coinbase
,
interrupt
)
!=
nil
}
func
(
w
*
worker
)
commitTransactionsWithError
(
txs
*
types
.
TransactionsByPriceAndNonce
,
coinbase
common
.
Address
,
interrupt
*
int32
)
error
{
// Short circuit if current is nil
if
w
.
current
==
nil
{
return
true
return
ErrCannotCommitTxn
}
if
w
.
current
.
gasPool
==
nil
{
...
...
@@ -803,7 +817,11 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
inc
:
true
,
}
}
return
w
.
current
.
tcount
==
0
||
atomic
.
LoadInt32
(
interrupt
)
==
commitInterruptNewHead
if
w
.
current
.
tcount
==
0
||
atomic
.
LoadInt32
(
interrupt
)
==
commitInterruptNewHead
{
return
ErrCannotCommitTxn
}
return
nil
}
// If we don't have enough gas for any further transactions then we're done
if
w
.
current
.
gasPool
.
Gas
()
<
params
.
TxGas
{
...
...
@@ -883,7 +901,10 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
if
interrupt
!=
nil
{
w
.
resubmitAdjustCh
<-
&
intervalAdjust
{
inc
:
false
}
}
return
w
.
current
.
tcount
==
0
if
w
.
current
.
tcount
==
0
{
return
ErrCannotCommitTxn
}
return
nil
}
// commitNewTx is an OVM addition that mines a block with a single tx in it.
...
...
@@ -945,8 +966,8 @@ func (w *worker) commitNewTx(tx *types.Transaction) error {
acc
,
_
:=
types
.
Sender
(
w
.
current
.
signer
,
tx
)
transactions
[
acc
]
=
types
.
Transactions
{
tx
}
txs
:=
types
.
NewTransactionsByPriceAndNonce
(
w
.
current
.
signer
,
transactions
)
if
w
.
commitTransactions
(
txs
,
w
.
coinbase
,
nil
)
{
return
err
ors
.
New
(
"Cannot commit transaction in miner"
)
if
err
:=
w
.
commitTransactionsWithError
(
txs
,
w
.
coinbase
,
nil
);
err
!=
nil
{
return
err
}
return
w
.
commit
(
nil
,
w
.
fullTaskHook
,
tstart
)
}
...
...
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