contrib/linearize: Support linearization of testnet blocks
This commit is contained in:
parent
26e08a16a6
commit
7f68c7dc05
2 changed files with 14 additions and 2 deletions
|
@ -4,13 +4,23 @@ rpcuser=someuser
|
||||||
rpcpassword=somepassword
|
rpcpassword=somepassword
|
||||||
host=127.0.0.1
|
host=127.0.0.1
|
||||||
port=8332
|
port=8332
|
||||||
|
#port=18332
|
||||||
|
|
||||||
# bootstrap.dat hashlist settings (linearize-hashes)
|
# bootstrap.dat hashlist settings (linearize-hashes)
|
||||||
max_height=313000
|
max_height=313000
|
||||||
|
|
||||||
# bootstrap.dat input/output settings (linearize-data)
|
# bootstrap.dat input/output settings (linearize-data)
|
||||||
|
|
||||||
|
# mainnet
|
||||||
netmagic=f9beb4d9
|
netmagic=f9beb4d9
|
||||||
|
genesis=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
|
||||||
input=/home/example/.bitcoin/blocks
|
input=/home/example/.bitcoin/blocks
|
||||||
|
|
||||||
|
# testnet
|
||||||
|
#netmagic=0b110907
|
||||||
|
#genesis=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
|
||||||
|
#input=/home/example/.bitcoin/testnet3/blocks
|
||||||
|
|
||||||
output_file=/home/example/Downloads/bootstrap.dat
|
output_file=/home/example/Downloads/bootstrap.dat
|
||||||
hashlist=hashlist.txt
|
hashlist=hashlist.txt
|
||||||
split_year=1
|
split_year=1
|
||||||
|
|
|
@ -205,7 +205,7 @@ class BlockDataCopier:
|
||||||
|
|
||||||
inMagic = inhdr[:4]
|
inMagic = inhdr[:4]
|
||||||
if (inMagic != self.settings['netmagic']):
|
if (inMagic != self.settings['netmagic']):
|
||||||
print("Invalid magic: " + inMagic)
|
print("Invalid magic: " + inMagic.encode('hex'))
|
||||||
return
|
return
|
||||||
inLenLE = inhdr[4:]
|
inLenLE = inhdr[4:]
|
||||||
su = struct.unpack("<I", inLenLE)
|
su = struct.unpack("<I", inLenLE)
|
||||||
|
@ -265,6 +265,8 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if 'netmagic' not in settings:
|
if 'netmagic' not in settings:
|
||||||
settings['netmagic'] = 'f9beb4d9'
|
settings['netmagic'] = 'f9beb4d9'
|
||||||
|
if 'genesis' not in settings:
|
||||||
|
settings['genesis'] = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
|
||||||
if 'input' not in settings:
|
if 'input' not in settings:
|
||||||
settings['input'] = 'input'
|
settings['input'] = 'input'
|
||||||
if 'hashlist' not in settings:
|
if 'hashlist' not in settings:
|
||||||
|
@ -291,7 +293,7 @@ if __name__ == '__main__':
|
||||||
blkindex = get_block_hashes(settings)
|
blkindex = get_block_hashes(settings)
|
||||||
blkmap = mkblockmap(blkindex)
|
blkmap = mkblockmap(blkindex)
|
||||||
|
|
||||||
if not "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" in blkmap:
|
if not settings['genesis'] in blkmap:
|
||||||
print("Genesis block not found in hashlist")
|
print("Genesis block not found in hashlist")
|
||||||
else:
|
else:
|
||||||
BlockDataCopier(settings, blkindex, blkmap).run()
|
BlockDataCopier(settings, blkindex, blkmap).run()
|
||||||
|
|
Loading…
Reference in a new issue