From: genjix Date: Sun, 15 Apr 2012 18:54:00 +0000 (+0100) Subject: mempool counter should work for output too. X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=commitdiff_plain;h=2291b3c91ab39fb5338d9078e2a9a46e46bb56c7 mempool counter should work for output too. --- diff --git a/backends/libbitcoin/history.py b/backends/libbitcoin/history.py index f81027a..0310d5b 100644 --- a/backends/libbitcoin/history.py +++ b/backends/libbitcoin/history.py @@ -217,18 +217,18 @@ class History: result.append(entry.output_loaded) mempool_result = [] for info in self.membuf_result: + if not self.mempool_counter.has_key(info["tx_hash"]): + if not self.mempool_counter: + count = 0 + else: + count = max(self.mempool_counter.values()) + 1 + self.mempool_counter[info["tx_hash"]] = count + else: + count = self.mempool_counter[info["tx_hash"]] + info["block_hash"] = "mempool:%s" % count # Lookup prevout in result # Set "value" field if info["is_input"] == 1: - if not self.mempool_counter.has_key(info["tx_hash"]): - if not self.mempool_counter: - count = 0 - else: - count = max(self.mempool_counter.values()) + 1 - self.mempool_counter[info["tx_hash"]] = count - else: - count = self.mempool_counter[info["tx_hash"]] - info["block_hash"] = "mempool:%s" % count prevout_tx = None for prevout_info in result: if prevout_info["tx_hash"] == info.previous_output.hash: @@ -390,7 +390,6 @@ class History: # No more inputs left to load # This info has finished loading info["height"] = None - info["block_hash"] = "mempool" self.finish_if_done() if __name__ == "__main__":