fix(txpool): prevent underflow in blobstore versioned hash lookup (#22454)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
strmfos
2026-02-21 09:54:09 +01:00
committed by GitHub
parent 190157636e
commit bc33eb764a
2 changed files with 10 additions and 4 deletions

View File

@@ -82,8 +82,11 @@ impl DiskFileBlobStore {
for (hash_idx, match_result) in
blob_sidecar.match_versioned_hashes(versioned_hashes)
{
result[hash_idx] = Some(match_result);
missing_count -= 1;
let slot = &mut result[hash_idx];
if slot.is_none() {
missing_count -= 1;
}
*slot = Some(match_result);
}
}

View File

@@ -30,8 +30,11 @@ impl InMemoryBlobStore {
for (hash_idx, match_result) in
blob_sidecar.match_versioned_hashes(versioned_hashes)
{
result[hash_idx] = Some(match_result);
missing_count -= 1;
let slot = &mut result[hash_idx];
if slot.is_none() {
missing_count -= 1;
}
*slot = Some(match_result);
}
}