mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
commando: add filtering support.
1. When we receive a commando command from a remote using the `filter` field, use it. 2. Add a `filter` parameter to `commando` to send it: this is usually more efficient than using filtering locally. Of course, older remote nodes will ignore the filter, but that's harmless. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: Plugins: `commando` now supports `filter` as a parameter (for send and receive).
This commit is contained in:
@@ -2648,6 +2648,14 @@ def test_commando(node_factory, executor):
|
||||
assert len(res['peers']) == 1
|
||||
assert res['peers'][0]['id'] == l2.info['id']
|
||||
|
||||
# Filter test
|
||||
res = l2.rpc.call(method='commando',
|
||||
payload={'peer_id': l1.info['id'],
|
||||
'rune': rune,
|
||||
'method': 'listpeers',
|
||||
'filter': {'peers': [{'id': True}]}})
|
||||
assert res == {'peers': [{'id': l2.info['id']}]}
|
||||
|
||||
with pytest.raises(RpcError, match='missing required parameter'):
|
||||
l2.rpc.call(method='commando',
|
||||
payload={'peer_id': l1.info['id'],
|
||||
|
||||
Reference in New Issue
Block a user