good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Erigon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
a
Erigon
Commits
e0d7998e
Unverified
Commit
e0d7998e
authored
2 years ago
by
ledgerwatch
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Truncate bor receipts on unwind (#4033)
Co-authored-by:
Alexey Sharp
<
alexeysharp@Alexeys-iMac.local
>
parent
93ab7f5d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/rawdb/bor_receipts.go
+11
-0
11 additions, 0 deletions
core/rawdb/bor_receipts.go
eth/stagedsync/stage_execute.go
+5
-2
5 additions, 2 deletions
eth/stagedsync/stage_execute.go
with
16 additions
and
2 deletions
core/rawdb/bor_receipts.go
+
11
−
0
View file @
e0d7998e
...
...
@@ -5,6 +5,7 @@ import (
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/common/dbutils"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/rlp"
"github.com/ledgerwatch/log/v3"
...
...
@@ -147,3 +148,13 @@ func ReadBorTransaction(db kv.Tx, hash common.Hash) (*types.Transaction, common.
var
tx
types
.
Transaction
=
types
.
NewBorTransaction
()
return
&
tx
,
blockHash
,
*
blockNumber
,
uint64
(
bodyForStorage
.
TxAmount
),
nil
}
// TruncateBorReceipts removes all bor receipt for given block number or newer
func
TruncateBorReceipts
(
db
kv
.
RwTx
,
number
uint64
)
error
{
if
err
:=
db
.
ForEach
(
kv
.
BorReceipts
,
dbutils
.
EncodeBlockNumber
(
number
),
func
(
k
,
_
[]
byte
)
error
{
return
db
.
Delete
(
kv
.
BorReceipts
,
k
,
nil
)
});
err
!=
nil
{
return
err
}
return
nil
}
This diff is collapsed.
Click to expand it.
eth/stagedsync/stage_execute.go
+
5
−
2
View file @
e0d7998e
...
...
@@ -520,10 +520,13 @@ func unwindExecutionStage(u *UnwindState, s *StageState, tx kv.RwTx, quit <-chan
}
if
err
:=
rawdb
.
TruncateReceipts
(
tx
,
u
.
UnwindPoint
+
1
);
err
!=
nil
{
return
fmt
.
Errorf
(
"walking receipts: %w"
,
err
)
return
fmt
.
Errorf
(
"truncate receipts: %w"
,
err
)
}
if
err
:=
rawdb
.
TruncateBorReceipts
(
tx
,
u
.
UnwindPoint
+
1
);
err
!=
nil
{
return
fmt
.
Errorf
(
"truncate bor receipts: %w"
,
err
)
}
if
err
:=
rawdb
.
DeleteNewerEpochs
(
tx
,
u
.
UnwindPoint
+
1
);
err
!=
nil
{
return
fmt
.
Errorf
(
"
walking
epoch: %w"
,
err
)
return
fmt
.
Errorf
(
"
delete newer
epoch
s
: %w"
,
err
)
}
// Truncate CallTraceSet
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment