Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/linearize: Support linearization of testnet blocks #6168

Merged
merged 1 commit into from May 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions contrib/linearize/example-linearize.cfg
Expand Up @@ -4,13 +4,23 @@ rpcuser=someuser
rpcpassword=somepassword
host=127.0.0.1
port=8332
#port=18332

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

# bootstrap.dat input/output settings (linearize-data)

# mainnet
netmagic=f9beb4d9
genesis=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
input=/home/example/.bitcoin/blocks

# testnet
#netmagic=0b110907
#genesis=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
#input=/home/example/.bitcoin/testnet3/blocks

output_file=/home/example/Downloads/bootstrap.dat
hashlist=hashlist.txt
split_year=1
Expand Down
6 changes: 4 additions & 2 deletions contrib/linearize/linearize-data.py
Expand Up @@ -205,7 +205,7 @@ def run(self):

inMagic = inhdr[:4]
if (inMagic != self.settings['netmagic']):
print("Invalid magic: " + inMagic)
print("Invalid magic: " + inMagic.encode('hex'))
return
inLenLE = inhdr[4:]
su = struct.unpack("<I", inLenLE)
Expand Down Expand Up @@ -265,6 +265,8 @@ def run(self):

if 'netmagic' not in settings:
settings['netmagic'] = 'f9beb4d9'
if 'genesis' not in settings:
settings['genesis'] = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
if 'input' not in settings:
settings['input'] = 'input'
if 'hashlist' not in settings:
Expand All @@ -291,7 +293,7 @@ def run(self):
blkindex = get_block_hashes(settings)
blkmap = mkblockmap(blkindex)

if not "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" in blkmap:
if not settings['genesis'] in blkmap:
print("Genesis block not found in hashlist")
else:
BlockDataCopier(settings, blkindex, blkmap).run()
Expand Down