mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
commando: don't look at messages *at all* unless they've created a rune.
This means we can leave commando on by default, without an explicit config flag. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -263,7 +263,8 @@ static void handle_incmd(struct node_id *peer,
|
|||||||
{
|
{
|
||||||
struct commando *incmd;
|
struct commando *incmd;
|
||||||
|
|
||||||
/* FIXME: don't do *anything* unless they've set up a rune. */
|
if (!rune_counter)
|
||||||
|
return;
|
||||||
|
|
||||||
incmd = find_commando(incoming_commands, peer, NULL);
|
incmd = find_commando(incoming_commands, peer, NULL);
|
||||||
/* Don't let them buffer multiple commands: discard old. */
|
/* Don't let them buffer multiple commands: discard old. */
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from utils import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
|
import concurrent.futures
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
@@ -2549,6 +2550,15 @@ def test_plugin_shutdown(node_factory):
|
|||||||
def test_commando(node_factory, executor):
|
def test_commando(node_factory, executor):
|
||||||
l1, l2 = node_factory.line_graph(2, fundchannel=False)
|
l1, l2 = node_factory.line_graph(2, fundchannel=False)
|
||||||
|
|
||||||
|
# Nothing works until we've issued a rune.
|
||||||
|
fut = executor.submit(l2.rpc.call, method='commando',
|
||||||
|
payload={'peer_id': l1.info['id'],
|
||||||
|
'method': 'listpeers'})
|
||||||
|
with pytest.raises(concurrent.futures.TimeoutError):
|
||||||
|
fut.result(10)
|
||||||
|
|
||||||
|
l1.rpc.commando_rune()
|
||||||
|
|
||||||
# This works
|
# This works
|
||||||
res = l2.rpc.call(method='commando',
|
res = l2.rpc.call(method='commando',
|
||||||
payload={'peer_id': l1.info['id'],
|
payload={'peer_id': l1.info['id'],
|
||||||
|
|||||||
Reference in New Issue
Block a user