mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-21 14:04:20 +01:00
plugins/topology: add direction field to listchannels.
It's a core concept in the spec which isn't directly exposed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: JSON-RPC: `listchannels` added a `direction` field (0 or 1) as per gossip specification.
This commit is contained in:
committed by
Alex Myers
parent
611795beee
commit
9ab488fc41
@@ -425,6 +425,10 @@ def test_gossip_jsonrpc(node_factory):
|
||||
channels2 = l2.rpc.listchannels(source=l1.info['id'])['channels']
|
||||
assert only_one(channels1)['source'] == l1.info['id']
|
||||
assert only_one(channels1)['destination'] == l2.info['id']
|
||||
if l1.info['id'] > l2.info['id']:
|
||||
assert only_one(channels1)['direction'] == 1
|
||||
else:
|
||||
assert only_one(channels1)['direction'] == 0
|
||||
assert channels1 == channels2
|
||||
|
||||
# Test listchannels-by-destination
|
||||
@@ -432,6 +436,10 @@ def test_gossip_jsonrpc(node_factory):
|
||||
channels2 = l2.rpc.listchannels(destination=l1.info['id'])['channels']
|
||||
assert only_one(channels1)['destination'] == l1.info['id']
|
||||
assert only_one(channels1)['source'] == l2.info['id']
|
||||
if l2.info['id'] > l1.info['id']:
|
||||
assert only_one(channels1)['direction'] == 1
|
||||
else:
|
||||
assert only_one(channels1)['direction'] == 0
|
||||
assert channels1 == channels2
|
||||
|
||||
# Test only one of short_channel_id, source or destination can be supplied
|
||||
|
||||
Reference in New Issue
Block a user