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
81c8a806
Commit
81c8a806
authored
Jun 02, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feedback & lint errors
parent
1e67bc9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
blocks.go
indexer/database/blocks.go
+1
-1
db.go
indexer/database/db.go
+2
-1
No files found.
indexer/database/blocks.go
View file @
81c8a806
...
...
@@ -95,7 +95,7 @@ func (db *blocksDB) StoreLegacyStateBatch(stateBatch *LegacyStateBatch) error {
l2Headers
:=
make
([]
*
L2BlockHeader
,
stateBatch
.
Size
)
// [start, end] range is inclusive. Since `PrevTotal` is the index of the prior batch, no
// need to sub
s
tract one when adding the size
// need to subtract one when adding the size
startHeight
:=
U256
{
Int
:
big
.
NewInt
(
int64
(
stateBatch
.
PrevTotal
+
1
))}
endHeight
:=
U256
{
Int
:
big
.
NewInt
(
int64
(
stateBatch
.
PrevTotal
+
stateBatch
.
Size
))}
result
=
db
.
gorm
.
Where
(
"number BETWEEN ? AND ?"
,
&
startHeight
,
&
endHeight
)
.
Find
(
&
l2Headers
)
...
...
indexer/database/db.go
View file @
81c8a806
// Database module defines the data DB struct which wraps specific DB interfaces for L1/L2 block headers, contract events, bridging schemas.
package
database
import
(
...
...
@@ -15,7 +16,7 @@ type DB struct {
func
NewDB
(
dsn
string
)
(
*
DB
,
error
)
{
gorm
,
err
:=
gorm
.
Open
(
postgres
.
Open
(
dsn
),
&
gorm
.
Config
{
// The indexer will explictly manage the transaction
// The indexer will explic
i
tly manage the transaction
// flow processing blocks
SkipDefaultTransaction
:
true
,
})
...
...
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