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
38bc29a5
Commit
38bc29a5
authored
Jan 27, 2023
by
Sebastian Stammler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: Fix channelManager.addBlocks
The block index handling had multiple bugs.
parent
7d9a635f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
channel_manager.go
op-batcher/batcher/channel_manager.go
+13
-10
No files found.
op-batcher/batcher/channel_manager.go
View file @
38bc29a5
...
@@ -241,24 +241,27 @@ func (s *channelManager) ensurePendingChannel(l1Head eth.L1BlockRef) error {
...
@@ -241,24 +241,27 @@ func (s *channelManager) ensurePendingChannel(l1Head eth.L1BlockRef) error {
// addBlocks adds blocks from the blocks queue to the pending channel until
// addBlocks adds blocks from the blocks queue to the pending channel until
// either the queue got exhausted or the channel is full.
// either the queue got exhausted or the channel is full.
func
(
s
*
channelManager
)
addBlocks
()
error
{
func
(
s
*
channelManager
)
addBlocks
()
error
{
var
(
var
blocksAdded
int
blockidx
int
var
_chFullErr
*
ChannelFullError
// throw away, just for type checking
channelFull
bool
for
i
,
block
:=
range
s
.
blocks
{
)
if
err
:=
s
.
pendingChannel
.
AddBlock
(
block
);
errors
.
As
(
err
,
&
_chFullErr
)
{
for
;
blockidx
<
len
(
s
.
blocks
);
blockidx
++
{
// current block didn't get added because channel is already full
if
err
:=
s
.
pendingChannel
.
AddBlock
(
s
.
blocks
[
blockidx
]);
s
.
pendingChannel
.
IsFull
()
{
channelFull
=
true
break
break
}
else
if
err
!=
nil
{
}
else
if
err
!=
nil
{
return
fmt
.
Errorf
(
"adding block[%d] to channel builder: %w"
,
blockidx
,
err
)
return
fmt
.
Errorf
(
"adding block[%d] to channel builder: %w"
,
i
,
err
)
}
blocksAdded
+=
1
// current block got added but channel is now full
if
s
.
pendingChannel
.
IsFull
()
{
break
}
}
}
}
blocksAdded
:=
blockidx
+
1
s
.
log
.
Debug
(
"Added blocks to channel"
,
s
.
log
.
Debug
(
"Added blocks to channel"
,
"blocks_added"
,
blocksAdded
,
"blocks_added"
,
blocksAdded
,
"channel_full"
,
channelFull
,
"channel_full"
,
s
.
pendingChannel
.
IsFull
()
,
"blocks_pending"
,
len
(
s
.
blocks
)
-
blocksAdded
,
"blocks_pending"
,
len
(
s
.
blocks
)
-
blocksAdded
,
"input_bytes"
,
s
.
pendingChannel
.
InputBytes
(),
)
)
if
blocksAdded
==
len
(
s
.
blocks
)
{
if
blocksAdded
==
len
(
s
.
blocks
)
{
// all blocks processed, reuse slice
// all blocks processed, reuse slice
...
...
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