mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-05 20:50:18 +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
@ -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…
x
Reference in New Issue
Block a user