Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions p2p/src/sync/peer_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ struct OutgoingDataState {
/// The index of the best block that we've sent to the peer.
best_sent_block: Option<BlockIndex>,
/// The id of the best block header that we've sent to the peer.
// Note: at this moment this field is only informational, i.e. we only print it to the log,
// see the comment in handle_new_tip.
best_sent_block_header: Option<Id<GenBlock>>,
}

Expand Down Expand Up @@ -255,13 +253,9 @@ where
if self.send_tip_updates {
debug_assert!(self.common_services.has_service(Service::Blocks));

// Note: an intermediate implementation also used to use best_sent_block_header
// here when determining the latest fork point. But it doesn't seem to be a good
// idea to use it in the v1 protocol, because legacy peers may not maintain their
// "received pending headers" correctly. So, they may see the announced header list
// as disconnected. But they can only tolerate disconnected lists of length 1,
// therefore, they might ban us eventually.
if self.incoming.peers_best_block_that_we_have.is_some() || best_sent_block_id.is_some()
if self.incoming.peers_best_block_that_we_have.is_some()
|| best_sent_block_id.is_some()
|| self.outgoing.best_sent_block_header.is_some()
{
let limit = *self.p2p_config.msg_header_count_limit;
let new_tip_id = *new_tip_id;
Expand All @@ -271,6 +265,7 @@ where
.peers_best_block_that_we_have
.iter()
.chain(best_sent_block_id.iter())
.chain(self.outgoing.best_sent_block_header.iter())
.copied()
.collect();

Expand Down
7 changes: 3 additions & 4 deletions p2p/src/sync/tests/block_announcement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,9 @@ async fn best_known_header_is_considered(#[case] seed: Seed) {
node.assert_no_event().await;
}

// Note: since best_sent_block_header is currently not taken into account by
// the implementation, this portion of the test has to be disabled.
// TODO: it should be re-enabled when we switch to the protocol V2. See the issue #1110.
if false {
// Note: since best_sent_block_header is not taken into account by V1, this portion
// of the test has to be disabled.
if protocol_version >= SupportedProtocolVersion::V2.into() {
// Do exactly the same as in the previous section; the expected result is the same as well.
// The purpose of this is to ensure that the node correctly takes into account
// headers that it has already sent (as opposed to what headers have been revealed
Expand Down