From 1d5e05b75d797ad3df86ed2672f203d6bee7ca30 Mon Sep 17 00:00:00 2001 From: Cryp Toon Date: Fri, 9 Aug 2024 22:39:59 +0200 Subject: [PATCH] Add Litecoinspace mempool provider --- bitcoinlib/data/providers.json | 22 ++++++++++++++++++++++ bitcoinlib/services/services.py | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bitcoinlib/data/providers.json b/bitcoinlib/data/providers.json index d7fd2dc2..65457a5e 100644 --- a/bitcoinlib/data/providers.json +++ b/bitcoinlib/data/providers.json @@ -339,5 +339,27 @@ "priority": 10, "denominator": 1, "network_overrides": null + }, + "mempool.litecoin": { + "provider": "mempool", + "network": "litecoin_testnet", + "client_class": "MempoolClient", + "provider_coin_id": "", + "url": "https://litecoinspace.org/api/", + "api_key": "", + "priority": 11, + "denominator": 1, + "network_overrides": null + }, + "mempool.litecoin_testnet": { + "provider": "mempool", + "network": "litecoin_testnet", + "client_class": "MempoolClient", + "provider_coin_id": "", + "url": "https://litecoinspace.org/testnet/api/", + "api_key": "", + "priority": 11, + "denominator": 1, + "network_overrides": null } } diff --git a/bitcoinlib/services/services.py b/bitcoinlib/services/services.py index 0b5d0d54..e2b08d8c 100644 --- a/bitcoinlib/services/services.py +++ b/bitcoinlib/services/services.py @@ -369,7 +369,7 @@ def gettransactions(self, address, after_txid='', limit=MAX_TRANSACTIONS): # Get (extra) transactions from service providers txs = [] - if not(db_addr and db_addr.last_block and db_addr.last_block >= self.blockcount()) or not caching_enabled: + if not (db_addr and db_addr.last_block and db_addr.last_block >= self.blockcount()) or not caching_enabled: txs = self._provider_execute('gettransactions', address, qry_after_txid.hex(), limit) if txs is False: raise ServiceError("Error when retrieving transactions from service provider") @@ -381,7 +381,7 @@ def gettransactions(self, address, after_txid='', limit=MAX_TRANSACTIONS): # - disable cache if comparing providers or if after_txid is used and no cache is available last_block = None last_txid = None - if self.min_providers <= 1 and not(after_txid and not db_addr) and caching_enabled: + if self.min_providers <= 1 and not (after_txid and not db_addr) and caching_enabled: last_block = self.blockcount() last_txid = qry_after_txid self.complete = True