commit a39e270bd3b1789f6e87000efd2d9243b0fad05d
parent 5834b391ea82c677773f8fd670fc11904bea7c78
Author: ThomasV <thomasv@electrum.org>
Date: Tue, 18 Jul 2017 21:32:34 +0200
test height
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/blockchain.py b/lib/blockchain.py
@@ -319,14 +319,15 @@ class Blockchain(util.PrintError):
return new_bits, bitsBase << (8 * (bitsN-3))
def can_connect(self, header):
- previous_height = header['block_height'] - 1
- previous_header = self.read_header(previous_height)
+ height = header['block_height']
+ if self.height() != height - 1:
+ return False
+ previous_header = self.read_header(height -1)
if not previous_header:
return False
prev_hash = hash_header(previous_header)
if prev_hash != header.get('prev_block_hash'):
return False
- height = header.get('block_height')
bits, target = self.get_target(height / 2016)
try:
self.verify_header(header, previous_header, bits, target)