mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
json-rpc: Rename onion payload type to style
Suggested-by: Rusty Russell <@rustyrussell>
This commit is contained in:
parent
55d8dcc907
commit
21b5b59c8c
@ -261,7 +261,7 @@ struct command_result *param_hops_array(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
struct sphinx_hop **hops)
|
||||
{
|
||||
const jsmntok_t *hop, *payloadtok, *typetok, *pubkeytok;
|
||||
const jsmntok_t *hop, *payloadtok, *styletok, *pubkeytok;
|
||||
struct sphinx_hop h;
|
||||
size_t i;
|
||||
if (tok->type != JSMN_ARRAY) {
|
||||
@ -276,7 +276,7 @@ struct command_result *param_hops_array(struct command *cmd, const char *name,
|
||||
json_for_each_arr(i, hop, tok) {
|
||||
|
||||
payloadtok = json_get_member(buffer, hop, "payload");
|
||||
typetok = json_get_member(buffer, hop, "type");
|
||||
styletok = json_get_member(buffer, hop, "style");
|
||||
pubkeytok = json_get_member(buffer, hop, "pubkey");
|
||||
|
||||
if (!pubkeytok)
|
||||
@ -302,9 +302,9 @@ struct command_result *param_hops_array(struct command *cmd, const char *name,
|
||||
pubkeytok->end - pubkeytok->start,
|
||||
buffer + pubkeytok->start);
|
||||
|
||||
if (!typetok || json_tok_streq(buffer, typetok, "tlv")) {
|
||||
if (!styletok || json_tok_streq(buffer, styletok, "tlv")) {
|
||||
h.type = SPHINX_TLV_PAYLOAD;
|
||||
} else if (json_tok_streq(buffer, typetok, "legacy")) {
|
||||
} else if (json_tok_streq(buffer, styletok, "legacy")) {
|
||||
h.type = SPHINX_V0_PAYLOAD;
|
||||
} else {
|
||||
return command_fail(
|
||||
|
6
doc/lightning-createonion.7
generated
6
doc/lightning-createonion.7
generated
@ -19,15 +19,15 @@ payload destined for that node\. The following is an example of a 3 hop onion:
|
||||
.RS
|
||||
[
|
||||
{
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
||||
"payload": "000067000001000100000000000003e90000007b000000000000000000000000"
|
||||
}, {
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
||||
"payload": "000067000003000100000000000003e800000075000000000000000000000000"
|
||||
}, {
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199",
|
||||
"payload": "000067000003000100000000000003e800000075000000000000000000000000"
|
||||
}
|
||||
|
@ -19,15 +19,15 @@ payload destined for that node. The following is an example of a 3 hop onion:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
||||
"payload": "000067000001000100000000000003e90000007b000000000000000000000000"
|
||||
}, {
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
||||
"payload": "000067000003000100000000000003e800000075000000000000000000000000"
|
||||
}, {
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199",
|
||||
"payload": "000067000003000100000000000003e800000075000000000000000000000000"
|
||||
}
|
||||
|
@ -2448,7 +2448,7 @@ def test_createonion_rpc(node_factory):
|
||||
l1 = node_factory.get_node()
|
||||
|
||||
hops = [{
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619",
|
||||
"payload": "0000000000000000000000000000000000000000"
|
||||
}, {
|
||||
@ -2461,7 +2461,7 @@ def test_createonion_rpc(node_factory):
|
||||
"pubkey": "032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
|
||||
"payload": "0303030303030303000000000000000300000003"
|
||||
}, {
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": "02edabbd16b41c8371b92ef2f04c1185b4f03b6dcd52ba9b78d9d7c89c8f221145",
|
||||
"payload": "0404040404040404000000000000000400000004"
|
||||
}]
|
||||
@ -2501,14 +2501,14 @@ def test_sendonion_rpc(node_factory):
|
||||
for h, n in zip(route[:-1], route[1:]):
|
||||
# We tell the node h about the parameters to use for n (a.k.a. h + 1)
|
||||
hops.append({
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": h['id'],
|
||||
"payload": serialize_payload(n)
|
||||
})
|
||||
|
||||
# The last hop has a special payload:
|
||||
hops.append({
|
||||
"type": "legacy",
|
||||
"style": "legacy",
|
||||
"pubkey": route[-1]['id'],
|
||||
"payload": serialize_payload(route[-1])
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user