electrum

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

commit 9455815ad0089486bcd3ceef447b7cc704190f47
parent b64c42b1eb48789146afc8218a26b2d341205e25
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Wed, 26 Aug 2015 17:12:40 +0900

Merge requested_merkle and merkle_roots.

Diffstat:
Mlib/verifier.py | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/verifier.py b/lib/verifier.py @@ -28,18 +28,19 @@ class SPV(ThreadJob): def __init__(self, network, wallet): self.wallet = wallet self.network = network - self.merkle_roots = {} # hashed by me - self.requested_merkle = set() + # Keyed by tx hash. Value is None if the merkle branch was + # requested, and the merkle root once it has been verified + self.merkle_roots = {} def run(self): unverified = self.wallet.get_unverified_txs() for (tx_hash, tx_height) in unverified: - if tx_hash not in self.merkle_roots and tx_hash not in self.requested_merkle: + if tx_hash not in self.merkle_roots: request = ('blockchain.transaction.get_merkle', [tx_hash, tx_height]) if self.network.send([request], self.merkle_response): self.print_error('requested merkle', tx_hash) - self.requested_merkle.add(tx_hash) + self.merkle_roots[tx_hash] = None def merkle_response(self, r): if r.get('error'):