Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
a21e963a
Unverified
Commit
a21e963a
authored
Jan 13, 2023
by
rjl493456442
Committed by
GitHub
Jan 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/catalyst: trigger beacon sync directly with provided chain head (#26489)
parent
d379e3f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
tester.go
eth/catalyst/tester.go
+11
-14
No files found.
eth/catalyst/tester.go
View file @
a21e963a
...
...
@@ -20,9 +20,9 @@ import (
"sync"
"time"
"github.com/ethereum/go-ethereum/core/beacon"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
)
...
...
@@ -50,10 +50,7 @@ func RegisterFullSyncTester(stack *node.Node, backend *eth.Ethereum, block *type
return
cl
,
nil
}
// Start launches the full-sync tester by spinning up a background thread
// for keeping firing NewPayload-UpdateForkChoice combos with the provided
// target block, it may or may not trigger the beacon sync depends on if
// there are protocol peers connected.
// Start launches the beacon sync with provided sync target.
func
(
tester
*
FullSyncTester
)
Start
()
error
{
tester
.
wg
.
Add
(
1
)
go
func
()
{
...
...
@@ -70,19 +67,19 @@ func (tester *FullSyncTester) Start() error {
continue
}
// Short circuit in case the target block is already stored
// locally.
// locally. TODO(somehow terminate the node stack if target
// is reached).
if
tester
.
api
.
eth
.
BlockChain
()
.
HasBlock
(
tester
.
block
.
Hash
(),
tester
.
block
.
NumberU64
())
{
log
.
Info
(
"Full-sync target reached"
,
"number"
,
tester
.
block
.
NumberU64
(),
"hash"
,
tester
.
block
.
Hash
())
return
}
// Shoot out consensus events in order to trigger syncing.
data
:=
beacon
.
BlockToExecutableData
(
tester
.
block
)
tester
.
api
.
NewPayloadV1
(
*
data
)
tester
.
api
.
ForkchoiceUpdatedV1
(
beacon
.
ForkchoiceStateV1
{
HeadBlockHash
:
tester
.
block
.
Hash
(),
SafeBlockHash
:
tester
.
block
.
Hash
(),
FinalizedBlockHash
:
tester
.
block
.
Hash
(),
},
nil
)
// Trigger beacon sync with the provided block header as
// trusted chain head.
err
:=
tester
.
api
.
eth
.
Downloader
()
.
BeaconSync
(
downloader
.
FullSync
,
tester
.
block
.
Header
())
if
err
!=
nil
{
log
.
Info
(
"Failed to beacon sync"
,
"err"
,
err
)
}
case
<-
tester
.
closed
:
return
}
...
...
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