1
0

save header immediately when forking a chain

This commit is contained in:
ThomasV
2017-07-21 07:52:38 +02:00
parent 2bb980c84c
commit 313d53fe0b
2 changed files with 21 additions and 17 deletions

View File

@@ -300,9 +300,9 @@ class Blockchain(util.PrintError):
new_bits = bitsN << 24 | bitsBase
return new_bits, bitsBase << (8 * (bitsN-3))
def can_connect(self, header):
def can_connect(self, header, check_height=True):
height = header['block_height']
if self.height() != height - 1:
if check_height and self.height() != height - 1:
return False
if height == 0:
return hash_header(header) == bitcoin.GENESIS