Skip to content

Commit

Permalink
A couple of tweaks to the prior commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Booth committed Mar 14, 2017
1 parent 654f457 commit 0fdd23a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def block_full(cls, block, height):
block and its height.'''

if height > 0:
return cls.block_full(block, height)
return super().block_full(block, height)
else:
return Block(cls.block_header(block, height), [])

Expand Down
10 changes: 5 additions & 5 deletions server/block_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ def advance_blocks(self, blocks):
It is already verified they correctly connect onto our tip.
'''
headers = [block.header for block in blocks]
min_height = self.min_undo_height(self.daemon.cached_height())
height = self.height

Expand All @@ -493,6 +492,7 @@ def advance_blocks(self, blocks):
if height >= min_height:
self.undo_infos.append((undo_info, height))

headers = [block.header for block in blocks]
self.height = height
self.headers.extend(headers)
self.tip = self.coin.header_hash(headers[-1])
Expand Down Expand Up @@ -567,14 +567,14 @@ def backup_blocks(self, blocks):
coin = self.coin
for block in blocks:
# Check and update self.tip
header, txs = coin.block_full(block, self.height)
header_hash = coin.header_hash(header)
block_full = coin.block_full(block, self.height)
header_hash = coin.header_hash(block_full.header)
if header_hash != self.tip:
raise ChainError('backup block {} not tip {} at height {:,d}'
.format(hash_to_str(header_hash),
hash_to_str(self.tip), self.height))
self.tip = coin.header_prevhash(header)
self.backup_txs(txs)
self.tip = coin.header_prevhash(block_full.header)
self.backup_txs(block_full.transactions)
self.height -= 1
self.tx_counts.pop()

Expand Down

0 comments on commit 0fdd23a

Please sign in to comment.