Skip to content

Commit 7f68c7d

Browse files
Jeff GarzikJeff Garzik
authored andcommitted
contrib/linearize: Support linearization of testnet blocks
1 parent 26e08a1 commit 7f68c7d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

contrib/linearize/example-linearize.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ rpcuser=someuser
44
rpcpassword=somepassword
55
host=127.0.0.1
66
port=8332
7+
#port=18332
78

89
# bootstrap.dat hashlist settings (linearize-hashes)
910
max_height=313000
1011

1112
# bootstrap.dat input/output settings (linearize-data)
13+
14+
# mainnet
1215
netmagic=f9beb4d9
16+
genesis=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
1317
input=/home/example/.bitcoin/blocks
18+
19+
# testnet
20+
#netmagic=0b110907
21+
#genesis=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
22+
#input=/home/example/.bitcoin/testnet3/blocks
23+
1424
output_file=/home/example/Downloads/bootstrap.dat
1525
hashlist=hashlist.txt
1626
split_year=1

contrib/linearize/linearize-data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def run(self):
205205

206206
inMagic = inhdr[:4]
207207
if (inMagic != self.settings['netmagic']):
208-
print("Invalid magic: " + inMagic)
208+
print("Invalid magic: " + inMagic.encode('hex'))
209209
return
210210
inLenLE = inhdr[4:]
211211
su = struct.unpack("<I", inLenLE)
@@ -265,6 +265,8 @@ def run(self):
265265

266266
if 'netmagic' not in settings:
267267
settings['netmagic'] = 'f9beb4d9'
268+
if 'genesis' not in settings:
269+
settings['genesis'] = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
268270
if 'input' not in settings:
269271
settings['input'] = 'input'
270272
if 'hashlist' not in settings:
@@ -291,7 +293,7 @@ def run(self):
291293
blkindex = get_block_hashes(settings)
292294
blkmap = mkblockmap(blkindex)
293295

294-
if not "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" in blkmap:
296+
if not settings['genesis'] in blkmap:
295297
print("Genesis block not found in hashlist")
296298
else:
297299
BlockDataCopier(settings, blkindex, blkmap).run()

0 commit comments

Comments
 (0)