mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
lightningd: treat JSON ids as direct tokens.
This avoids any confusion between primitive and string ids, and in particular stops an issue with commando once it starts chaining ids, that weird ids can be double-escaped and commando will not recognize the response, leaving the client hanging. It's the client's fault for using a weird id, but it's still rude (and triggered by our tests!). It also makes substituting the id in passthrough simpler, FTW. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -21,7 +21,7 @@ def test_invoice(node_factory, chainparams):
|
||||
|
||||
# Side note: invoice calls out to listincoming, so check JSON id is as expected
|
||||
myname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
|
||||
l1.daemon.wait_for_log(r": {}:invoice#[0-9]*/cln:listincoming#[0-9]*\[OUT\]".format(myname))
|
||||
l1.daemon.wait_for_log(r': "{}:invoice#[0-9]*/cln:listincoming#[0-9]*"\[OUT\]'.format(myname))
|
||||
|
||||
after = int(time.time())
|
||||
b11 = l1.rpc.decodepay(inv['bolt11'])
|
||||
|
||||
@@ -874,7 +874,7 @@ def test_cli(node_factory):
|
||||
assert 'help [command]\n List available commands, or give verbose help on one {command}' in out
|
||||
|
||||
# Check JSON id is as expected
|
||||
l1.daemon.wait_for_log(r"jsonrpc#[0-9]*: cli:help#[0-9]*\[IN\]")
|
||||
l1.daemon.wait_for_log(r'jsonrpc#[0-9]*: "cli:help#[0-9]*"\[IN\]')
|
||||
|
||||
# Test JSON output.
|
||||
out = subprocess.check_output(['cli/lightning-cli',
|
||||
|
||||
@@ -1539,7 +1539,7 @@ def test_libplugin(node_factory):
|
||||
# Test hooks and notifications (add plugin, so we can test hook id)
|
||||
l2 = node_factory.get_node(options={"plugin": plugin, 'log-level': 'io'})
|
||||
l2.connect(l1)
|
||||
l2.daemon.wait_for_log(r": {}:connect#[0-9]*/cln:peer_connected#[0-9]*\[OUT\]".format(myname))
|
||||
l2.daemon.wait_for_log(r': "{}:connect#[0-9]*/cln:peer_connected#[0-9]*"\[OUT\]'.format(myname))
|
||||
|
||||
l1.daemon.wait_for_log("{} peer_connected".format(l2.info["id"]))
|
||||
l1.daemon.wait_for_log("{} connected".format(l2.info["id"]))
|
||||
|
||||
@@ -62,7 +62,7 @@ def test_withdraw(node_factory, bitcoind):
|
||||
|
||||
# Side note: sendrawtransaction will trace back to withdrawl
|
||||
myname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
|
||||
l1.daemon.wait_for_log(r": {}:withdraw#[0-9]*/cln:withdraw#[0-9]*/txprepare:sendpsbt#[0-9]*/cln:sendrawtransaction#[0-9]*\[OUT\]".format(myname))
|
||||
l1.daemon.wait_for_log(r': "{}:withdraw#[0-9]*/cln:withdraw#[0-9]*/txprepare:sendpsbt#[0-9]*/cln:sendrawtransaction#[0-9]*"\[OUT\]'.format(myname))
|
||||
|
||||
# Make sure bitcoind received the withdrawal
|
||||
unspent = l1.bitcoin.rpc.listunspent(0)
|
||||
|
||||
Reference in New Issue
Block a user