mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 01:38:04 +00:00
fixed panic on empty remote read request (#4619)
This commit is contained in:
committed by
GitHub
parent
3219be2508
commit
afba48aeba
@@ -1472,6 +1472,13 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
|
||||
who: PeerId,
|
||||
request: message::RemoteReadRequest<B::Hash>,
|
||||
) {
|
||||
if request.keys.is_empty() {
|
||||
debug!(target: "sync", "Invalid remote read request sent by {}", who);
|
||||
self.behaviour.disconnect_peer(&who);
|
||||
self.peerset_handle.report_peer(who, rep::BAD_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
let keys_str = || match request.keys.len() {
|
||||
1 => request.keys[0].to_hex::<String>(),
|
||||
_ => format!(
|
||||
@@ -1510,6 +1517,13 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
|
||||
who: PeerId,
|
||||
request: message::RemoteReadChildRequest<B::Hash>,
|
||||
) {
|
||||
if request.keys.is_empty() {
|
||||
debug!(target: "sync", "Invalid remote child read request sent by {}", who);
|
||||
self.behaviour.disconnect_peer(&who);
|
||||
self.peerset_handle.report_peer(who, rep::BAD_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
let keys_str = || match request.keys.len() {
|
||||
1 => request.keys[0].to_hex::<String>(),
|
||||
_ => format!(
|
||||
|
||||
Reference in New Issue
Block a user