From 1fd5328337a10ace6303a04b0429f24f0a56b9b2 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 5 Nov 2023 15:45:02 +0100 Subject: [PATCH 1/2] Fix panic when peer doesn't have block --- light-base/src/sync_service.rs | 8 ++++---- wasm-node/CHANGELOG.md | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/light-base/src/sync_service.rs b/light-base/src/sync_service.rs index 79fc75ed27..50427475f2 100644 --- a/light-base/src/sync_service.rs +++ b/light-base/src/sync_service.rs @@ -358,8 +358,8 @@ impl SyncService { ) .await { - Ok(b) => b, - Err(_) => continue, + Ok(b) if !b.is_empty() => b, + Ok(_) | Err(_) => continue, }; return Ok(result.remove(0)); @@ -404,8 +404,8 @@ impl SyncService { ) .await { - Ok(b) => b, - Err(_) => continue, + Ok(b) if !b.is_empty() => b, + Ok(_) | Err(_) => continue, }; return Ok(result.remove(0)); diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index 49ce8c92d2..cabe2ddb99 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixed + +- Fix panic when requesting a block with a specific hash from the peer-to-peer network and none of the peers has the block. + ## 2.0.7 - 2023-11-02 ### Changed From 4ee5132fee4012a9c2b47165080af89eda692eee Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 5 Nov 2023 15:45:49 +0100 Subject: [PATCH 2/2] PR link --- wasm-node/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index cabe2ddb99..a4174633d1 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixed -- Fix panic when requesting a block with a specific hash from the peer-to-peer network and none of the peers has the block. +- Fix panic when requesting a block with a specific hash from the peer-to-peer network and none of the peers has the block. ([#1303](https://github.com/smol-dot/smoldot/pull/1303)) ## 2.0.7 - 2023-11-02