obelisk

Electrum server using libbitcoin as its backend
git clone https://git.parazyd.org/obelisk
Log | Files | Refs | README | LICENSE

commit b5f75215bd26c7ad7461ccd2af3bd8490ab9a690
parent bc3c4ee24a16a7397e41262acb25f8d4ef91375c
Author: parazyd <parazyd@dyne.org>
Date:   Thu, 15 Apr 2021 20:39:12 +0200

tests: Fix listunspent.

Diffstat:
Mobelisk/protocol.py | 6+-----
Mobelisk/zeromq.py | 3+--
Mtests/test_electrum_protocol.py | 9+++------
3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/obelisk/protocol.py b/obelisk/protocol.py @@ -452,11 +452,7 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902 "height": rec["height"], }) - if len(ret) < 2: - return {"result": ret} - - # return {"result": sorted(ret, key=lambda x: x["height"], reverse=True)} - return {"result": sorted(ret, key=lambda x: x["height"])} + return {"result": ret} async def scripthash_notifier(self, writer, scripthash): # TODO: Figure out how this actually works diff --git a/obelisk/zeromq.py b/obelisk/zeromq.py @@ -381,8 +381,7 @@ class Client: correlated_points = Client.__correlate(points) # self.log.debug("history points: %s", points) # self.log.debug("history correlated: %s", correlated_points) - # return error_code, self._sort_correlated_points(correlated_points) - return error_code, correlated_points + return error_code, self._sort_correlated_points(correlated_points) @staticmethod def _sort_correlated_points(points): diff --git a/tests/test_electrum_protocol.py b/tests/test_electrum_protocol.py @@ -143,15 +143,12 @@ async def test_blockchain_scripthash_listunspent(protocol, writer): params = [ "92dd1eb7c042956d3dd9185a58a2578f61fee91347196604540838ccd0f8c08c" ] + # Blockstream is broken here and doesn't return in ascending order. expect = get_expect(method, params) + srt = sorted(expect["result"], key=lambda x: x["height"]) data = await protocol.blockchain_scripthash_listunspent( writer, {"params": params}) - - pprint(expect) - print() - pprint(data) - - assert data["result"] == expect["result"] + assert data["result"] == srt async def test_blockchain_transaction_get(protocol, writer):