obelisk

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

commit 861f25b0c9dd1f231bd123f9fe5bed6dc9269b7a
parent d698075b700854a3de1790255d70da9d71edbe6c
Author: parazyd <parazyd@dyne.org>
Date:   Fri,  9 Apr 2021 02:31:40 +0200

Add test for blockchain_scripthash_get_balance

Diffstat:
Mtest.py | 35++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/test.py b/test.py @@ -76,6 +76,39 @@ async def test_blockchain_relayfee(protocol, writer): return "blockchain_relayfee", True +async def test_blockchain_scripthash_get_balance(protocol, writer): + shs = [ + "c036b0ff3ad79662cd517cd5fe1fa0af07377b9262d16f276f11ced69aaa6921", + "92dd1eb7c042956d3dd9185a58a2578f61fee91347196604540838ccd0f8c08c", + ] + expect = [ + { + "result": { + "confirmed": 0, + "unconfirmed": 0 + } + }, + { + "result": { + "confirmed": 831000, + "unconfirmed": 0 + } + }, + ] + + res = [] + for i in shs: + params = {"params": [i]} + res.append(await + protocol.blockchain_scripthash_get_balance(writer, params)) + + for i in expect: + if res[expect.index(i)] != i: + return "blockchain_scripthash_get_balance", False + + return "blockchain_scripthash_get_balance", True + + class MockWriter(asyncio.StreamWriter): def __init__(self): self.mock = None @@ -100,7 +133,7 @@ async def main(): test_blockchain_estimatefee, # test_blockchain_headers_subscribe, test_blockchain_relayfee, - # test_blockchain_scripthash_get_balance, + test_blockchain_scripthash_get_balance, # test_blockchain_scripthash_get_history, # test_blockchain_scripthash_get_mempool, # test_blockchain_scripthash_listunspent,