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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
a
Erigon
Commits
fd357f03
Unverified
Commit
fd357f03
authored
Sep 1, 2021
by
racytech
Committed by
GitHub
Sep 1, 2021
Browse files
Options
Downloads
Patches
Plain Diff
`bad.hash` flag added to exclude block by hash and not by number (#2612)
* BadHashFlag added * bad.hash to bad.block
parent
2c6d4ae4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
eth/backend.go
+11
-5
11 additions, 5 deletions
eth/backend.go
eth/ethconfig/config.go
+3
-3
3 additions, 3 deletions
eth/ethconfig/config.go
turbo/cli/flags.go
+11
-4
11 additions, 4 deletions
turbo/cli/flags.go
with
25 additions
and
12 deletions
eth/backend.go
+
11
−
5
View file @
fd357f03
...
@@ -447,16 +447,22 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere
...
@@ -447,16 +447,22 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
config
.
BadBlock
!=
0
{
var
badHash
common
.
Hash
emptyBadHash
:=
config
.
BadBlockHash
==
common
.
Hash
{}
if
!
emptyBadHash
{
var
badBlockHeader
*
types
.
Header
if
err
=
chainKv
.
View
(
context
.
Background
(),
func
(
tx
kv
.
Tx
)
error
{
if
err
=
chainKv
.
View
(
context
.
Background
(),
func
(
tx
kv
.
Tx
)
error
{
var
hErr
error
header
,
hErr
:=
rawdb
.
ReadHeaderByHash
(
tx
,
config
.
BadBlockHash
)
bad
Hash
,
hErr
=
rawdb
.
ReadCanonicalHash
(
tx
,
config
.
BadBlock
)
bad
BlockHeader
=
header
return
hErr
return
hErr
});
err
!=
nil
{
});
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
backend
.
stagedSync
.
UnwindTo
(
config
.
BadBlock
-
1
,
badHash
)
if
badBlockHeader
!=
nil
{
unwindPoint
:=
badBlockHeader
.
Number
.
Uint64
()
-
1
backend
.
stagedSync
.
UnwindTo
(
unwindPoint
,
config
.
BadBlockHash
)
}
}
}
go
txpropagate
.
BroadcastPendingTxsToNetwork
(
backend
.
downloadCtx
,
backend
.
txPool
,
backend
.
txPoolP2PServer
.
RecentPeers
,
backend
.
downloadServer
)
go
txpropagate
.
BroadcastPendingTxsToNetwork
(
backend
.
downloadCtx
,
backend
.
txPool
,
backend
.
txPoolP2PServer
.
RecentPeers
,
backend
.
downloadServer
)
...
...
This diff is collapsed.
Click to expand it.
eth/ethconfig/config.go
+
3
−
3
View file @
fd357f03
...
@@ -139,7 +139,7 @@ type Config struct {
...
@@ -139,7 +139,7 @@ type Config struct {
Prune
prune
.
Mode
Prune
prune
.
Mode
BatchSize
datasize
.
ByteSize
// Batch size for execution stage
BatchSize
datasize
.
ByteSize
// Batch size for execution stage
BadBlock
uint64
// Block marked as bad (for forced reorg)
BadBlock
Hash
common
.
Hash
// hash of the block marked as bad
Snapshot
Snapshot
Snapshot
Snapshot
...
...
This diff is collapsed.
Click to expand it.
turbo/cli/flags.go
+
11
−
4
View file @
fd357f03
...
@@ -8,7 +8,9 @@ import (
...
@@ -8,7 +8,9 @@ import (
"github.com/c2h5oh/datasize"
"github.com/c2h5oh/datasize"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cmd/utils"
"github.com/ledgerwatch/erigon/cmd/utils"
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/common/etl"
"github.com/ledgerwatch/erigon/common/etl"
"github.com/ledgerwatch/erigon/common/hexutil"
"github.com/ledgerwatch/erigon/eth/ethconfig"
"github.com/ledgerwatch/erigon/eth/ethconfig"
"github.com/ledgerwatch/erigon/ethdb/prune"
"github.com/ledgerwatch/erigon/ethdb/prune"
"github.com/ledgerwatch/erigon/node"
"github.com/ledgerwatch/erigon/node"
...
@@ -150,10 +152,10 @@ var (
...
@@ -150,10 +152,10 @@ var (
Value
:
""
,
Value
:
""
,
}
}
BadBlockFlag
=
cli
.
Int
Flag
{
BadBlockFlag
=
cli
.
String
Flag
{
Name
:
"bad.block"
,
Name
:
"bad.block"
,
Usage
:
"Marks block with given
number
bad and forces initial reorg before normal staged sync"
,
Usage
:
"Marks block with given
hex string as
bad and forces initial reorg before normal staged sync"
,
Value
:
0
,
Value
:
""
,
}
}
)
)
...
@@ -207,7 +209,12 @@ func ApplyFlagsForEthConfig(ctx *cli.Context, cfg *ethconfig.Config) {
...
@@ -207,7 +209,12 @@ func ApplyFlagsForEthConfig(ctx *cli.Context, cfg *ethconfig.Config) {
}
}
cfg
.
SyncLoopThrottle
=
syncLoopThrottle
cfg
.
SyncLoopThrottle
=
syncLoopThrottle
}
}
cfg
.
BadBlock
=
uint64
(
ctx
.
GlobalInt
(
BadBlockFlag
.
Name
))
bytes
,
err
:=
hexutil
.
Decode
(
BadBlockFlag
.
Value
)
if
err
!=
nil
{
log
.
Warn
(
"Error decoding hash %v: %v"
,
BadBlockFlag
.
Value
,
err
)
}
cfg
.
BadBlockHash
=
common
.
BytesToHash
(
bytes
)
}
}
func
ApplyFlagsForEthConfigCobra
(
f
*
pflag
.
FlagSet
,
cfg
*
ethconfig
.
Config
)
{
func
ApplyFlagsForEthConfigCobra
(
f
*
pflag
.
FlagSet
,
cfg
*
ethconfig
.
Config
)
{
...
...
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