From 310f53af8f95c7ddf7e323ca2759be9a088d2097 Mon Sep 17 00:00:00 2001 From: Cryp Toon Date: Tue, 8 Oct 2024 21:14:06 +0200 Subject: [PATCH] Strange hack to let blockstream provider work --- bitcoinlib/services/blockstream.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bitcoinlib/services/blockstream.py b/bitcoinlib/services/blockstream.py index 7b676db2..5fc846c8 100644 --- a/bitcoinlib/services/blockstream.py +++ b/bitcoinlib/services/blockstream.py @@ -161,7 +161,10 @@ def gettransactions(self, address, after_txid='', limit=MAX_TRANSACTIONS): if len(prtxs) > limit: break txs = [] - prtxs.sort(key=lambda x: x['status']['block_height']) + if len(set([x['status']['block_height'] for x in prtxs])) > 1: + prtxs.sort(key=lambda x: x['status']['block_height']) + else: + prtxs = prtxs[::-1] for tx in prtxs: t = self._parse_transaction(tx) if t: