Skip to content

Commit

Permalink
Added listfunds test
Browse files Browse the repository at this point in the history
  • Loading branch information
hosiawak authored and cdecker committed Dec 22, 2020
1 parent 8bc3690 commit f31a27e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2410,3 +2410,24 @@ def test_listtransactions(node_factory):
# The txid of the transaction funding the channel is present, and
# represented as little endian (like bitcoind and explorers).
assert wallettxid in txids


def test_listfunds(node_factory):
"""Test listfunds command."""
l1, l2 = node_factory.get_nodes(2, opts=[{}, {}])

open_txid = l1.openchannel(l2, 10**5)["wallettxid"]

# unspent outputs
utxos = l1.rpc.listfunds()["outputs"]

# only 1 unspent output should be available
assert len(utxos) == 1

# both unspent and spent outputs
all_outputs = l1.rpc.listfunds(spent=True)["outputs"]
txids = [output['txid'] for output in all_outputs]

# 1 spent output (channel opening) and 1 unspent output
assert len(all_outputs) == 2
assert open_txid in txids

0 comments on commit f31a27e

Please sign in to comment.