mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
pytest: demonstrate failing rpc_command hook rewrite to plugin.
lightningd: lightningd/plugin.c:648: plugin_rpcmethod_dispatch: Assertion `idtok != NULL' failed. lightningd: FATAL SIGNAL 6 (version v0.7.3-234-gf3aeb51-modded) 0x557652363eb1 send_backtrace common/daemon.c:41 0x557652363f5b crashdump common/daemon.c:54 0x7f5b065a346f ??? ???:0 0x7f5b065a33eb ??? ???:0 0x7f5b06582898 ??? ???:0 0x7f5b06582768 ??? ???:0 0x7f5b06594005 ??? ???:0 0x557652355901 plugin_rpcmethod_dispatch lightningd/plugin.c:648 0x557652331836 command_exec lightningd/jsonrpc.c:588 0x557652331bad rpc_command_hook_callback lightningd/jsonrpc.c:655 0x557652358745 plugin_hook_callback lightningd/plugin_hook.c:90 0x55765235486a plugin_response_handle lightningd/plugin.c:258 0x557652354a16 plugin_read_json_one lightningd/plugin.c:356 0x557652354b6d plugin_read_json lightningd/plugin.c:388 0x5576523b5e6c next_plan ccan/ccan/io/io.c:59 0x5576523b6a51 do_plan ccan/ccan/io/io.c:407 0x5576523b6a93 io_ready ccan/ccan/io/io.c:417 0x5576523b8d2b io_loop ccan/ccan/io/poll.c:445 0x55765232dc6f io_loop_with_timers lightningd/io_loop_with_timers.c:24 0x557652334a6e main lightningd/lightningd.c:848 0x7f5b065841e2 ??? ???:0 0x5576523193ed ??? ???:0 0xffffffffffffffff ??? ???:0 Log dumped in crash.log.20191206093336 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
f6ed7f2e89
commit
e572b487d3
@@ -21,6 +21,9 @@ def on_rpc_command(plugin, rpc_command, **kwargs):
|
||||
# Don't allow this command to be executed
|
||||
return {"return": {"error": {"code": -1,
|
||||
"message": "You cannot do this"}}}
|
||||
elif request["method"] == "help":
|
||||
request["method"] = "autocleaninvoice"
|
||||
return {"replace": request}
|
||||
return {"continue": True}
|
||||
|
||||
|
||||
|
||||
@@ -761,6 +761,7 @@ def test_sendpay_notifications(node_factory, bitcoind):
|
||||
assert results['sendpay_failure'][0] == err.value.error
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
def test_rpc_command_hook(node_factory):
|
||||
"""Test the `sensitive_command` hook"""
|
||||
plugin = os.path.join(os.getcwd(), "tests/plugins/rpc_command.py")
|
||||
@@ -779,5 +780,8 @@ def test_rpc_command_hook(node_factory):
|
||||
funds = l1.rpc.listfunds()
|
||||
assert funds[0] == "Custom result"
|
||||
|
||||
# Test command redirection to a plugin
|
||||
l1.rpc.call('help', [0])
|
||||
|
||||
# Test command which removes plugin itself!
|
||||
l1.rpc.plugin_stop('rpc_command.py')
|
||||
|
||||
Reference in New Issue
Block a user