mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
scripts: search for next position of magic bytes rather than fail
document seek method for next position of magic bytes
This commit is contained in:
parent
6e431296da
commit
3284e6c09a
1 changed files with 5 additions and 2 deletions
|
|
@ -213,8 +213,11 @@ class BlockDataCopier:
|
|||
|
||||
inMagic = inhdr[:4]
|
||||
if (inMagic != self.settings['netmagic']):
|
||||
print("Invalid magic: " + inMagic.hex())
|
||||
return
|
||||
# Seek backwards 7 bytes (skipping the first byte in the previous search)
|
||||
# and continue searching from the new position if the magic bytes are not
|
||||
# found.
|
||||
self.inF.seek(-7, os.SEEK_CUR)
|
||||
continue
|
||||
inLenLE = inhdr[4:]
|
||||
su = struct.unpack("<I", inLenLE)
|
||||
inLen = su[0] - 80 # length without header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue