From add31871cbed7f650d83094761abea32a379d2c3 Mon Sep 17 00:00:00 2001 From: nikurt <86772482+nikurt@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:16:56 +0100 Subject: [PATCH] fix: State Sync Header Request no longer crashes a node (#10313) --- chain/chain/src/chain.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chain/chain/src/chain.rs b/chain/chain/src/chain.rs index 06e9efe277b..79ce1079f93 100644 --- a/chain/chain/src/chain.rs +++ b/chain/chain/src/chain.rs @@ -3006,7 +3006,11 @@ impl Chain { ); let mut root_proofs_cur = vec![]; - assert_eq!(receipt_proofs.len(), block_header.chunks_included() as usize); + if receipt_proofs.len() != block_header.chunks_included() as usize { + // Happens if a node doesn't track all shards and can't provide + // all incoming receipts to a chunk. + return Err(Error::Other("Not tracking all shards".to_owned())); + } for receipt_proof in receipt_proofs.iter() { let ReceiptProof(receipts, shard_proof) = receipt_proof; let ShardProof { from_shard_id, to_shard_id: _, proof } = shard_proof;