mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-16 20:01:37 +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]
|
inMagic = inhdr[:4]
|
||||||
if (inMagic != self.settings['netmagic']):
|
if (inMagic != self.settings['netmagic']):
|
||||||
print("Invalid magic: " + inMagic.hex())
|
# Seek backwards 7 bytes (skipping the first byte in the previous search)
|
||||||
return
|
# 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:]
|
inLenLE = inhdr[4:]
|
||||||
su = struct.unpack("<I", inLenLE)
|
su = struct.unpack("<I", inLenLE)
|
||||||
inLen = su[0] - 80 # length without header
|
inLen = su[0] - 80 # length without header
|
||||||
|
Loading…
x
Reference in New Issue
Block a user