1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-24 23:08:39 +01:00

Make sure no block is skipped during parsing

This commit is contained in:
Roman Zeyde 2018-06-25 13:11:46 +03:00
parent 5891133528
commit 2cf765ba5c
No known key found for this signature in database
GPG key ID: 87CAE5FA46917CBB

View file

@ -127,7 +127,10 @@ fn parse_blocks(blob: &[u8]) -> Result<Vec<Block>> {
let pos = cursor.position();
let mut decoder = RawDecoder::new(cursor);
match decoder.read_u32().chain_err(|| "no magic")? {
0 => break,
0 => {
cursor = decoder.into_inner(); // skip zeroes
continue;
}
0xD9B4BEF9 => (),
x => bail!("incorrect magic {:x} at {}", x, pos),
};