Skip to content
Commit d3c7a99d authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Update common block in sync after importing blocks of a peer, please read UPDATE (#7733)



* Update common block in sync after importing blocks of a peer

This updates the sync code to update the common block of a peer, after
we have imported blocks from this peer. This fixes a bug for when we are
connected to one or more nodes that are doing a full sync as our node.
Nodes in full sync will not announce new blocks, as we don't send import
notifications on full sync. The problem as now that we were connected to
some peer that reported some low number as its best and we tried to sync
these blocks. But, as we did not update the common block of this peer,
we would sync these blocks over and over again. Being captured in some
time warp.
The solution to this problem is that we increase the common number as we
import blocks from this peer.

* Test

* Test name..

* Fix test

* Cleanup some code and write some new regression test

* Implement the ancestor search

* Check that the common number is smaller than the last finalized block

* Update client/network/src/protocol/sync.rs

Co-authored-by: default avatarAndré Silva <[email protected]>

* Update client/network/src/protocol/sync.rs

Co-authored-by: default avatarAndré Silva <[email protected]>

* Update client/network/src/protocol/sync.rs

Co-authored-by: default avatarAndré Silva <[email protected]>

* Change the way we build the status messages

* Start some new test...

* Finish test

* Rename test

* Update client/network/src/protocol.rs

Co-authored-by: default avatarAndré Silva <[email protected]>

Co-authored-by: default avatarAndré Silva <[email protected]>
parent 9a3cab74
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment