mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
lightningd: rename sendonionmessage to sendobsonionmessage.
sendonionmessage is going to be the new one, and do much *less*. As this is an internal experimental-only API, no deprecation cycle required. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
191798bb56
commit
37ddf2e829
@ -125,7 +125,7 @@ void handle_obs_onionmsg_to_us(struct lightningd *ld, const u8 *msg)
|
||||
payload->reply_path = tal_free(payload->reply_path);
|
||||
}
|
||||
|
||||
log_debug(ld->log, "Got onionmsg%s%s",
|
||||
log_debug(ld->log, "Got obsolete onionmsg%s%s",
|
||||
payload->reply_blinding ? " reply_blinding": "",
|
||||
payload->reply_path ? " reply_path": "");
|
||||
|
||||
@ -389,10 +389,10 @@ static void populate_tlvs(struct hop *hops,
|
||||
}
|
||||
}
|
||||
|
||||
static struct command_result *json_send_onion_message(struct command *cmd,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj UNNEEDED,
|
||||
const jsmntok_t *params)
|
||||
static struct command_result *json_send_obs_onion_message(struct command *cmd,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj UNNEEDED,
|
||||
const jsmntok_t *params)
|
||||
{
|
||||
struct hop *hops;
|
||||
struct tlv_onionmsg_payload_obs_reply_path *reply_path;
|
||||
@ -447,10 +447,10 @@ static struct command_result *json_send_onion_message(struct command *cmd,
|
||||
return command_success(cmd, json_stream_success(cmd));
|
||||
}
|
||||
|
||||
static const struct json_command send_onion_message_command = {
|
||||
"sendonionmessage",
|
||||
static const struct json_command send_obs_onion_message_command = {
|
||||
"sendobsonionmessage",
|
||||
"utility",
|
||||
json_send_onion_message,
|
||||
json_send_obs_onion_message,
|
||||
"Send message over {hops} (id, [short_channel_id], [blinding], [enctlv], [invoice], [invoice_request], [invoice_error], [rawtlv]) with optional {reply_path} (blinding, path[id, enctlv])"
|
||||
};
|
||||
AUTODATA(json_command, &send_onion_message_command);
|
||||
AUTODATA(json_command, &send_obs_onion_message_command);
|
||||
|
@ -649,7 +649,7 @@ static struct command_result *send_message(struct command *cmd,
|
||||
path = make_blindedpath(tmpctx, backwards, &blinding,
|
||||
&sent->reply_blinding);
|
||||
|
||||
req = jsonrpc_request_start(cmd->plugin, cmd, "sendonionmessage",
|
||||
req = jsonrpc_request_start(cmd->plugin, cmd, "sendobsonionmessage",
|
||||
done,
|
||||
forward_error,
|
||||
sent);
|
||||
|
@ -52,7 +52,7 @@ send_onion_reply(struct command *cmd,
|
||||
replyfield, tal_hex(tmpctx, replydata));
|
||||
|
||||
/* Send to requester, using return route. */
|
||||
req = jsonrpc_request_start(cmd->plugin, cmd, "sendonionmessage",
|
||||
req = jsonrpc_request_start(cmd->plugin, cmd, "sendobsonionmessage",
|
||||
finished, sendonionmessage_error, NULL);
|
||||
|
||||
/* Add reply into last hop. */
|
||||
|
@ -13,7 +13,7 @@ def on_onion_message(plugin, onion_message, **kwargs):
|
||||
plugin.log("no reply path")
|
||||
return
|
||||
|
||||
plugin.rpc.call('sendonionmessage', [onion_message['reply_path']])
|
||||
plugin.rpc.call('sendobsonionmessage', [onion_message['reply_path']])
|
||||
plugin.log("Got onion_message invoice '{}'".format(onion_message['invoice']))
|
||||
plugin.log("Sent reply via {}".format(onion_message['reply_path']))
|
||||
return {"result": "continue"}
|
||||
|
@ -2335,24 +2335,24 @@ def test_sendcustommsg(node_factory):
|
||||
])
|
||||
|
||||
|
||||
def test_sendonionmessage(node_factory):
|
||||
def test_sendobsonionmessage(node_factory):
|
||||
l1, l2, l3 = node_factory.line_graph(3, opts={'experimental-onion-messages': None})
|
||||
|
||||
blindedpathtool = os.path.join(os.path.dirname(__file__), "..", "devtools", "blindedpath")
|
||||
|
||||
l1.rpc.call('sendonionmessage',
|
||||
l1.rpc.call('sendobsonionmessage',
|
||||
{'hops':
|
||||
[{'id': l2.info['id']},
|
||||
{'id': l3.info['id']}]})
|
||||
assert l3.daemon.wait_for_log('Got onionmsg')
|
||||
assert l3.daemon.wait_for_log('Got obsolete onionmsg')
|
||||
|
||||
# Now by SCID.
|
||||
l1.rpc.call('sendonionmessage',
|
||||
l1.rpc.call('sendobsonionmessage',
|
||||
{'hops':
|
||||
[{'id': l2.info['id'],
|
||||
'short_channel_id': l2.get_channel_scid(l3)},
|
||||
{'id': l3.info['id']}]})
|
||||
assert l3.daemon.wait_for_log('Got onionmsg')
|
||||
assert l3.daemon.wait_for_log('Got obsolete onionmsg')
|
||||
|
||||
# Now test blinded path.
|
||||
output = subprocess.check_output(
|
||||
@ -2364,17 +2364,17 @@ def test_sendonionmessage(node_factory):
|
||||
# First hop can't be blinded!
|
||||
assert p1 == l2.info['id']
|
||||
|
||||
l1.rpc.call('sendonionmessage',
|
||||
l1.rpc.call('sendobsonionmessage',
|
||||
{'hops':
|
||||
[{'id': l2.info['id'],
|
||||
'blinding': blinding,
|
||||
'enctlv': p1enc},
|
||||
{'id': p2}]})
|
||||
assert l3.daemon.wait_for_log('Got onionmsg')
|
||||
assert l3.daemon.wait_for_log('Got obsolete onionmsg')
|
||||
|
||||
|
||||
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Needs sendonionmessage")
|
||||
def test_sendonionmessage_reply(node_factory):
|
||||
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Needs sendobsonionmessage")
|
||||
def test_sendobsonionmessage_reply(node_factory):
|
||||
blindedpathtool = os.path.join(os.path.dirname(__file__), "..", "devtools", "blindedpath")
|
||||
|
||||
plugin = os.path.join(os.path.dirname(__file__), "plugins", "onionmessage-reply.py")
|
||||
@ -2391,7 +2391,7 @@ def test_sendonionmessage_reply(node_factory):
|
||||
assert p1 == l2.info['id']
|
||||
|
||||
# Also tests oversize payload which won't fit in 1366-byte onion.
|
||||
l1.rpc.call('sendonionmessage',
|
||||
l1.rpc.call('sendobsonionmessage',
|
||||
{'hops':
|
||||
[{'id': l2.info['id']},
|
||||
{'id': l3.info['id'],
|
||||
@ -2400,10 +2400,10 @@ def test_sendonionmessage_reply(node_factory):
|
||||
{'blinding': blinding,
|
||||
'path': [{'id': p1, 'enctlv': p1enc}, {'id': p2}]}})
|
||||
|
||||
assert l3.daemon.wait_for_log('Got onionmsg reply_blinding reply_path')
|
||||
assert l3.daemon.wait_for_log('Got obsolete onionmsg reply_blinding reply_path')
|
||||
assert l3.daemon.wait_for_log("Got onion_message invoice '{}'".format('77' * 15000))
|
||||
assert l3.daemon.wait_for_log('Sent reply via')
|
||||
assert l1.daemon.wait_for_log('Got onionmsg')
|
||||
assert l1.daemon.wait_for_log('Got obsolete onionmsg')
|
||||
|
||||
|
||||
@pytest.mark.developer("needs --dev-force-privkey")
|
||||
|
Loading…
Reference in New Issue
Block a user