electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 6ee0ad8499181f0ddc3fcd0262ada3bcfdc19107
parent 814792eee1a26ecc6b3438ccc8255d8f26e7ee3c
Author: ThomasV <thomasv@electrum.org>
Date:   Wed, 19 Jul 2017 05:45:41 +0200

fix: swap

Diffstat:
Mlib/blockchain.py | 12++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/lib/blockchain.py b/lib/blockchain.py @@ -197,14 +197,14 @@ class Blockchain(util.PrintError): self.print_error("saved", self.filename) def swap_with_parent(self): - self.print_error("swap") + self.print_error("swap", self.filename, self.parent.filename) parent = self.parent checkpoint = self.checkpoint # copy headers parent.headers = [parent.read_header(h) for h in range(checkpoint, checkpoint + parent.get_branch_size())] # truncate parent file with open(parent.path(), 'rb+') as f: - f.seek(checkpoint*80) + f.seek((checkpoint - parent.checkpoint)*80) f.truncate() parent.is_saved = False # swap chains @@ -272,14 +272,6 @@ class Blockchain(util.PrintError): h = self.local_height return sum([self.BIP9(h-i, 2) for i in range(N)])*10000/N/100. - def truncate_headers(self, height): - self.print_error('Truncating headers file at height %d'%height) - name = self.path() - f = open(name, 'rb+') - f.seek(height * 80) - f.truncate() - f.close() - def get_target(self, index, chain=None): if bitcoin.TESTNET: return 0, 0