From 62a531b1d08652209a78e175a0ce1828e42beb54 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Fri, 2 Dec 2016 18:43:15 +0900 Subject: [PATCH 1/2] Revert "Fix ref leak in mempool updates" This reverts commit 6c95644ae0ed41da103c0fc61e4501b779be80e2. --- server/protocol.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/server/protocol.py b/server/protocol.py index d6c06eb..bae092d 100644 --- a/server/protocol.py +++ b/server/protocol.py @@ -77,16 +77,6 @@ class MemPool(util.LoggedClass): touched = set() missing_utxos = [] - def drop_tx(hex_hash): - txin_pairs, txout_pairs, _u = self.txs.pop(hex_hash) - hash168s = set(hash168 for hash168, value in txin_pairs) - hash168s.update(hash168 for hash168, value in txout_pairs) - for hash168 in hash168s: - self.hash168s[hash168].remove(hex_hash) - if not self.hash168s[hash168]: - del self.hash168s[hash168] - touched.update(hash168s) - initial = self.count < 0 if initial: self.logger.info('beginning import of {:,d} mempool txs' @@ -95,7 +85,14 @@ class MemPool(util.LoggedClass): # Remove gone items gone = set(self.txs).difference(hex_hashes) for hex_hash in gone: - drop_tx(hex_hash) + txin_pairs, txout_pairs, unconfirmed = self.txs.pop(hex_hash) + hash168s = set(hash168 for hash168, value in txin_pairs) + hash168s.update(hash168 for hash168, value in txout_pairs) + for hash168 in hash168s: + self.hash168s[hash168].remove(hex_hash) + if not self.hash168s[hash168]: + del self.hash168s[hash168] + touched.update(hash168s) # Get the raw transactions for the new hashes. Ignore the # ones the daemon no longer has (it will return None). Put @@ -122,7 +119,7 @@ class MemPool(util.LoggedClass): if n % 20 == 0: await asyncio.sleep(0) txout_pairs = [txout_pair(txout) for txout in tx.outputs] - self.txs[hex_hash] = ([], txout_pairs, None) + self.txs[hex_hash] = (None, txout_pairs, None) def txin_info(txin): hex_hash = hash_to_str(txin.prev_hash) @@ -156,7 +153,7 @@ class MemPool(util.LoggedClass): # it's harmless - next time the mempool is refreshed # they'll either be cleaned up or the UTXOs will no # longer be missing. - drop_tx(hex_hash) + del self.txs[hex_hash] continue self.txs[hex_hash] = (txin_pairs, txout_pairs, any(unconfs)) From f1e0676a4702caa0e5374b0ffeef1e6891baa989 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Fri, 2 Dec 2016 18:44:36 +0900 Subject: [PATCH 2/2] Prepare 0.7.19 --- RELEASE-NOTES | 5 +++++ server/version.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 016f7a6..a3d8a25 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +version 0.7.19 +-------------- + +- revert mempool change of 0.7.18 + version 0.7.18 -------------- diff --git a/server/version.py b/server/version.py index 71fdbbb..0aa8848 100644 --- a/server/version.py +++ b/server/version.py @@ -1 +1 @@ -VERSION = "ElectrumX 0.7.18" +VERSION = "ElectrumX 0.7.19"