8000 added back support for receiving StateResponse by pompon0 · Pull Request #8377 · near/nearcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

added back support for receiving StateResponse #8377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 18, 2023
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
4 changes: 4 additions & 0 deletions chain/network/src/network_protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ pub enum RoutedMessageBody {

StateRequestHeader(ShardId, CryptoHash),
StateRequestPart(ShardId, CryptoHash, u64),
/// StateResponse in not produced since protocol version 58.
/// We can remove the support for it in protocol version 60.
/// It has been obsoleted by VersionedStateResponse which
/// is a superset of StateResponse values.
StateResponse(StateResponseInfoV1),
PartialEncodedChunkRequest(PartialEncodedChunkRequestMsg),
PartialEncodedChunkResponse(PartialEncodedChunkResponseMsg),
Expand Down
6 changes: 5 additions & 1 deletion chain/network/src/peer/peer_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::concurrency::demux;
use crate::network_protocol::{
Edge, EdgeState, Encoding, OwnedAccount, ParsePeerMessageError, PartialEdgeInfo,
PeerChainInfoV2, PeerIdOrHash, PeerInfo, RawRoutedMessage, RoutedMessageBody, RoutedMessageV2,
RoutingTableUpdate, SyncAccountsData,
RoutingTableUpdate, StateResponseInfo, SyncAccountsData,
};
use crate::peer::stream;
use crate::peer::tracker::Tracker;
Expand Down Expand Up @@ -896,6 +896,10 @@ impl PeerActor {
network_state.client.state_response(info).await;
None
}
RoutedMessageBody::StateResponse(info) => {
network_state.client.state_response(StateResponseInfo::V1(info)).await;
None
}
RoutedMessageBody::BlockApproval(approval) => {
network_state.client.block_approval(approval, peer_id).await;
None
Expand Down
9 changes: 2 additions & 7 deletions chain/network/src/peer_manager/peer_manager_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::config;
use crate::debug::{DebugStatus, GetDebugStatus};
use crate::network_protocol::{
AccountOrPeerIdOrHash, Edge, PeerIdOrHash, PeerMessage, Ping, Pong, RawRoutedMessage,
RoutedMessageBody, SignedAccountData, StateResponseInfo,
RoutedMessageBody, SignedAccountData,
};
use crate::peer::peer_actor::PeerActor;
use crate::peer_manager::connection;
Expand Down Expand Up @@ -724,12 +724,7 @@ impl PeerManagerActor {
}
}
NetworkRequests::StateResponse { route_back, response } => {
let body = match response {
StateResponseInfo::V1(response) => RoutedMessageBody::StateResponse(response),
response @ StateResponseInfo::V2(_) => {
RoutedMessageBody::VersionedStateResponse(response)
}
};
let body = RoutedMessageBody::VersionedStateResponse(response);
if self.state.send_message_to_peer(
&self.clock,
tcp::Tier::T2,
Expand Down
0