Skip to content

Commit 37ddf2e

Browse files
committed
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>
1 parent 191798b commit 37ddf2e

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

lightningd/onion_message.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void handle_obs_onionmsg_to_us(struct lightningd *ld, const u8 *msg)
125125
payload->reply_path = tal_free(payload->reply_path);
126126
}
127127

128-
log_debug(ld->log, "Got onionmsg%s%s",
128+
log_debug(ld->log, "Got obsolete onionmsg%s%s",
129129
payload->reply_blinding ? " reply_blinding": "",
130130
payload->reply_path ? " reply_path": "");
131131

@@ -389,10 +389,10 @@ static void populate_tlvs(struct hop *hops,
389389
}
390390
}
391391

392-
static struct command_result *json_send_onion_message(struct command *cmd,
393-
const char *buffer,
394-
const jsmntok_t *obj UNNEEDED,
395-
const jsmntok_t *params)
392+
static struct command_result *json_send_obs_onion_message(struct command *cmd,
393+
const char *buffer,
394+
const jsmntok_t *obj UNNEEDED,
395+
const jsmntok_t *params)
396396
{
397397
struct hop *hops;
398398
struct tlv_onionmsg_payload_obs_reply_path *reply_path;
@@ -447,10 +447,10 @@ static struct command_result *json_send_onion_message(struct command *cmd,
447447
return command_success(cmd, json_stream_success(cmd));
448448
}
449449

450-
static const struct json_command send_onion_message_command = {
451-
"sendonionmessage",
450+
static const struct json_command send_obs_onion_message_command = {
451+
"sendobsonionmessage",
452452
"utility",
453-
json_send_onion_message,
453+
json_send_obs_onion_message,
454454
"Send message over {hops} (id, [short_channel_id], [blinding], [enctlv], [invoice], [invoice_request], [invoice_error], [rawtlv]) with optional {reply_path} (blinding, path[id, enctlv])"
455455
};
456-
AUTODATA(json_command, &send_onion_message_command);
456+
AUTODATA(json_command, &send_obs_onion_message_command);

plugins/fetchinvoice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static struct command_result *send_message(struct command *cmd,
649649
path = make_blindedpath(tmpctx, backwards, &blinding,
650650
&sent->reply_blinding);
651651

652-
req = jsonrpc_request_start(cmd->plugin, cmd, "sendonionmessage",
652+
req = jsonrpc_request_start(cmd->plugin, cmd, "sendobsonionmessage",
653653
done,
654654
forward_error,
655655
sent);

plugins/offers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ send_onion_reply(struct command *cmd,
5252
replyfield, tal_hex(tmpctx, replydata));
5353

5454
/* Send to requester, using return route. */
55-
req = jsonrpc_request_start(cmd->plugin, cmd, "sendonionmessage",
55+
req = jsonrpc_request_start(cmd->plugin, cmd, "sendobsonionmessage",
5656
finished, sendonionmessage_error, NULL);
5757

5858
/* Add reply into last hop. */

tests/plugins/onionmessage-reply.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def on_onion_message(plugin, onion_message, **kwargs):
1313
plugin.log("no reply path")
1414
return
1515

16-
plugin.rpc.call('sendonionmessage', [onion_message['reply_path']])
16+
plugin.rpc.call('sendobsonionmessage', [onion_message['reply_path']])
1717
plugin.log("Got onion_message invoice '{}'".format(onion_message['invoice']))
1818
plugin.log("Sent reply via {}".format(onion_message['reply_path']))
1919
return {"result": "continue"}

tests/test_misc.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,24 +2335,24 @@ def test_sendcustommsg(node_factory):
23352335
])
23362336

23372337

2338-
def test_sendonionmessage(node_factory):
2338+
def test_sendobsonionmessage(node_factory):
23392339
l1, l2, l3 = node_factory.line_graph(3, opts={'experimental-onion-messages': None})
23402340

23412341
blindedpathtool = os.path.join(os.path.dirname(__file__), "..", "devtools", "blindedpath")
23422342

2343-
l1.rpc.call('sendonionmessage',
2343+
l1.rpc.call('sendobsonionmessage',
23442344
{'hops':
23452345
[{'id': l2.info['id']},
23462346
{'id': l3.info['id']}]})
2347-
assert l3.daemon.wait_for_log('Got onionmsg')
2347+
assert l3.daemon.wait_for_log('Got obsolete onionmsg')
23482348

23492349
# Now by SCID.
2350-
l1.rpc.call('sendonionmessage',
2350+
l1.rpc.call('sendobsonionmessage',
23512351
{'hops':
23522352
[{'id': l2.info['id'],
23532353
'short_channel_id': l2.get_channel_scid(l3)},
23542354
{'id': l3.info['id']}]})
2355-
assert l3.daemon.wait_for_log('Got onionmsg')
2355+
assert l3.daemon.wait_for_log('Got obsolete onionmsg')
23562356

23572357
# Now test blinded path.
23582358
output = subprocess.check_output(
@@ -2364,17 +2364,17 @@ def test_sendonionmessage(node_factory):
23642364
# First hop can't be blinded!
23652365
assert p1 == l2.info['id']
23662366

2367-
l1.rpc.call('sendonionmessage',
2367+
l1.rpc.call('sendobsonionmessage',
23682368
{'hops':
23692369
[{'id': l2.info['id'],
23702370
'blinding': blinding,
23712371
'enctlv': p1enc},
23722372
{'id': p2}]})
2373-
assert l3.daemon.wait_for_log('Got onionmsg')
2373+
assert l3.daemon.wait_for_log('Got obsolete onionmsg')
23742374

23752375

2376-
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Needs sendonionmessage")
2377-
def test_sendonionmessage_reply(node_factory):
2376+
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Needs sendobsonionmessage")
2377+
def test_sendobsonionmessage_reply(node_factory):
23782378
blindedpathtool = os.path.join(os.path.dirname(__file__), "..", "devtools", "blindedpath")
23792379

23802380
plugin = os.path.join(os.path.dirname(__file__), "plugins", "onionmessage-reply.py")
@@ -2391,7 +2391,7 @@ def test_sendonionmessage_reply(node_factory):
23912391
assert p1 == l2.info['id']
23922392

23932393
# Also tests oversize payload which won't fit in 1366-byte onion.
2394-
l1.rpc.call('sendonionmessage',
2394+
l1.rpc.call('sendobsonionmessage',
23952395
{'hops':
23962396
[{'id': l2.info['id']},
23972397
{'id': l3.info['id'],
@@ -2400,10 +2400,10 @@ def test_sendonionmessage_reply(node_factory):
24002400
{'blinding': blinding,
24012401
'path': [{'id': p1, 'enctlv': p1enc}, {'id': p2}]}})
24022402

2403-
assert l3.daemon.wait_for_log('Got onionmsg reply_blinding reply_path')
2403+
assert l3.daemon.wait_for_log('Got obsolete onionmsg reply_blinding reply_path')
24042404
assert l3.daemon.wait_for_log("Got onion_message invoice '{}'".format('77' * 15000))
24052405
assert l3.daemon.wait_for_log('Sent reply via')
2406-
assert l1.daemon.wait_for_log('Got onionmsg')
2406+
assert l1.daemon.wait_for_log('Got obsolete onionmsg')
24072407

24082408

24092409
@pytest.mark.developer("needs --dev-force-privkey")

0 commit comments

Comments
 (0)