Skip to content

Commit 75400a2

Browse files
author
Jeff Garzik
committed
contrib/linearize: Guarantee that output is generated in-order
This was typically ensured implicitly by virtue of normal bitcoind operation. Adding an explicit check provides a stronger guarantee, and it is cheap to add.
1 parent 087eb43 commit 75400a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

contrib/linearize/linearize-data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ def copydata(settings, blkindex, blkset):
125125
print("Skipping unknown block " + hash_str)
126126
continue
127127

128+
if blkindex[blkCount] != hash_str:
129+
print("Out of order block.")
130+
print("Expected " + blkindex[blkCount])
131+
print("Got " + hash_str)
132+
sys.exit(1)
133+
128134
if not fileOutput and ((outsz + inLen) > maxOutSz):
129135
outF.close()
130136
outF = None

0 commit comments

Comments
 (0)