Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parity-ethereum
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
ddorgan
parity-ethereum
Commits
69a4349e
Commit
69a4349e
authored
8 years ago
by
Nikolay Volf
Browse files
Options
Downloads
Patches
Plain Diff
documentation
parent
efef36b5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sync/src/chain.rs
+6
-0
6 additions, 0 deletions
sync/src/chain.rs
with
6 additions
and
0 deletions
sync/src/chain.rs
+
6
−
0
View file @
69a4349e
...
...
@@ -1051,6 +1051,7 @@ impl ChainSync {
}
}
/// creates rlp to send for the tree defined by 'from' and 'to' hashes
fn
create_new_hashes_rlp
(
chain
:
&
BlockChainClient
,
from
:
&
H256
,
to
:
&
H256
)
->
Option
<
Bytes
>
{
match
chain
.tree_route
(
from
,
to
)
{
Some
(
route
)
=>
{
...
...
@@ -1065,10 +1066,12 @@ impl ChainSync {
}
}
/// creates latest block rlp for the given client
fn
create_latest_block_rlp
(
chain
:
&
BlockChainClient
)
->
Bytes
{
chain
.block
(
&
chain
.chain_info
()
.best_block_hash
)
.expect
(
"Creating latest block when there is none"
)
}
/// returns peer ids that have less blocks than our chain
fn
get_lagging_peers
(
&
self
,
io
:
&
SyncIo
)
->
Vec
<
PeerId
>
{
let
chain
=
io
.chain
();
let
chain_info
=
chain
.chain_info
();
...
...
@@ -1087,6 +1090,7 @@ impl ChainSync {
.cloned
()
.collect
::
<
Vec
<
PeerId
>>
()
}
/// propagades latest block to lagging peers
fn
propagade_blocks
(
&
mut
self
,
io
:
&
mut
SyncIo
)
->
usize
{
let
updated_peers
=
{
let
lagging_peers
=
self
.get_lagging_peers
(
io
);
...
...
@@ -1113,6 +1117,7 @@ impl ChainSync {
sent
}
/// propagades new known hashes to all peers
fn
propagade_new_hashes
(
&
mut
self
,
io
:
&
mut
SyncIo
)
->
usize
{
let
updated_peers
=
self
.get_lagging_peers
(
io
);
let
mut
sent
=
0
;
...
...
@@ -1141,6 +1146,7 @@ impl ChainSync {
trace!
(
target
:
"sync"
,
"Sent new hashes to peers: {:?}"
,
peers
);
}
/// should be called once chain has new block, triggers the latest block propagation
pub
fn
chain_blocks_verified
(
&
mut
self
,
io
:
&
mut
SyncIo
)
{
let
peers
=
self
.propagade_blocks
(
io
);
trace!
(
target
:
"sync"
,
"Sent latest block to peers: {:?}"
,
peers
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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