Skip to content

Commit be2fb2d

Browse files
author
Jeff Garzik
committed
Merge pull request #3518 from Michagogo/linearize-start-value
Tweak linearize.py to give more flexibility
2 parents 0e469b5 + 7a29fb5 commit be2fb2d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

contrib/linearize/linearize.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def get_blocks(settings):
7373
rpc = BitcoinRPC(settings['host'], settings['port'],
7474
settings['rpcuser'], settings['rpcpass'])
7575

76-
outf = open(settings['output'], 'wb')
76+
outf = open(settings['output'], 'ab')
7777

78-
for height in xrange(settings['max_height']+1):
78+
for height in xrange(settings['min_height'], settings['max_height']+1):
7979
data = getblock(rpc, settings, height)
8080

8181
outhdr = settings['netmagic']
@@ -114,6 +114,8 @@ def get_blocks(settings):
114114
settings['host'] = '127.0.0.1'
115115
if 'port' not in settings:
116116
settings['port'] = 8332
117+
if 'min_height' not in settings:
118+
settings['min_height'] = 0
117119
if 'max_height' not in settings:
118120
settings['max_height'] = 250000
119121
if 'rpcuser' not in settings or 'rpcpass' not in settings:
@@ -122,6 +124,7 @@ def get_blocks(settings):
122124

123125
settings['netmagic'] = settings['netmagic'].decode('hex')
124126
settings['port'] = int(settings['port'])
127+
settings['min_height'] = int(settings['min_height'])
125128
settings['max_height'] = int(settings['max_height'])
126129

127130
get_blocks(settings)

0 commit comments

Comments
 (0)