mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-12 10:30:29 +01:00
global: fix up quotes which are now in the master branch.
1. onion-message 2. blinded-payments 3. route-blinding 4. channel-type 5. warnings. Now they'll be checked correctly, and if the spec changes, we'll know to reexamine this code. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
f0d9fc6b2e
commit
ac3c178587
10 changed files with 15 additions and 17 deletions
|
@ -174,7 +174,7 @@ static u8 *decrypt_encmsg_raw(const tal_t *ctx,
|
||||||
*/
|
*/
|
||||||
subkey_from_hmac("rho", ss, &rho);
|
subkey_from_hmac("rho", ss, &rho);
|
||||||
|
|
||||||
/* BOLT-onion-message #4:
|
/* BOLT #4:
|
||||||
*- If the `encrypted_data` field is missing or cannot
|
*- If the `encrypted_data` field is missing or cannot
|
||||||
* be decrypted:
|
* be decrypted:
|
||||||
* - MUST return an error
|
* - MUST return an error
|
||||||
|
@ -204,7 +204,7 @@ struct tlv_encrypted_data_tlv *decrypt_encrypted_data(const tal_t *ctx,
|
||||||
const u8 *cursor = decrypt_encmsg_raw(tmpctx, blinding, ss, enctlv);
|
const u8 *cursor = decrypt_encmsg_raw(tmpctx, blinding, ss, enctlv);
|
||||||
size_t maxlen = tal_bytelen(cursor);
|
size_t maxlen = tal_bytelen(cursor);
|
||||||
|
|
||||||
/* BOLT-onion-message #4:
|
/* BOLT #4:
|
||||||
*
|
*
|
||||||
* - MUST return an error if `encrypted_recipient_data` does not decrypt
|
* - MUST return an error if `encrypted_recipient_data` does not decrypt
|
||||||
* using the blinding point as described in
|
* using the blinding point as described in
|
||||||
|
|
|
@ -18,7 +18,7 @@ u8 **blinded_onion_hops(const tal_t *ctx,
|
||||||
bool first = (i == 0);
|
bool first = (i == 0);
|
||||||
bool final = (i == tal_count(onions) - 1);
|
bool final = (i == tal_count(onions) - 1);
|
||||||
|
|
||||||
/* BOLT-blinded-payments #4:
|
/* BOLT #4:
|
||||||
* - For every node inside a blinded route:
|
* - For every node inside a blinded route:
|
||||||
* - MUST include the `encrypted_recipient_data` provided by the
|
* - MUST include the `encrypted_recipient_data` provided by the
|
||||||
* recipient
|
* recipient
|
||||||
|
@ -27,6 +27,7 @@ u8 **blinded_onion_hops(const tal_t *ctx,
|
||||||
* recipient in `current_blinding_point`
|
* recipient in `current_blinding_point`
|
||||||
* - If it is the final node:
|
* - If it is the final node:
|
||||||
* - MUST include `amt_to_forward`, `outgoing_cltv_value` and `total_amount_msat`.
|
* - MUST include `amt_to_forward`, `outgoing_cltv_value` and `total_amount_msat`.
|
||||||
|
*...
|
||||||
* - MUST NOT include any other tlv field.
|
* - MUST NOT include any other tlv field.
|
||||||
*/
|
*/
|
||||||
onions[i] = onion_blinded_hop(onions,
|
onions[i] = onion_blinded_hop(onions,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* only onion tlv payloads. */
|
* only onion tlv payloads. */
|
||||||
#define ROUTING_MAX_HOPS 20
|
#define ROUTING_MAX_HOPS 20
|
||||||
|
|
||||||
/* BOLT-f3a9f7f4e9e7a5a2997f3129e13d94090091846a #7:
|
/* BOLT #7:
|
||||||
*
|
*
|
||||||
* The `channel_flags` bitfield...individual bits:
|
* The `channel_flags` bitfield...individual bits:
|
||||||
*...
|
*...
|
||||||
|
|
|
@ -48,7 +48,7 @@ static bool decrypt_forwarding_onionmsg(const struct pubkey *blinding,
|
||||||
if (!encmsg)
|
if (!encmsg)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* BOLT-onion-message #4:
|
/* BOLT #4:
|
||||||
* - if it is not the final node according to the onion encryption:
|
* - if it is not the final node according to the onion encryption:
|
||||||
*...
|
*...
|
||||||
* - if the `encrypted_data_tlv` contains `path_id`:
|
* - if the `encrypted_data_tlv` contains `path_id`:
|
||||||
|
@ -57,7 +57,7 @@ static bool decrypt_forwarding_onionmsg(const struct pubkey *blinding,
|
||||||
if (encmsg->path_id)
|
if (encmsg->path_id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* BOLT-onion-message #4:
|
/* BOLT #4:
|
||||||
* - SHOULD forward the message using `onion_message` to the next peer
|
* - SHOULD forward the message using `onion_message` to the next peer
|
||||||
* indicated by `next_node_id`.
|
* indicated by `next_node_id`.
|
||||||
*/
|
*/
|
||||||
|
@ -159,7 +159,7 @@ bool onion_message_parse(const tal_t *ctx,
|
||||||
|
|
||||||
*final_om = NULL;
|
*final_om = NULL;
|
||||||
|
|
||||||
/* BOLT-onion-message #4:
|
/* BOLT #4:
|
||||||
* - if it is not the final node according to the onion encryption:
|
* - if it is not the final node according to the onion encryption:
|
||||||
* - if the `onionmsg_tlv` contains other tlv fields than `encrypted_recipient_data`:
|
* - if the `onionmsg_tlv` contains other tlv fields than `encrypted_recipient_data`:
|
||||||
* - MUST ignore the message.
|
* - MUST ignore the message.
|
||||||
|
|
|
@ -330,7 +330,7 @@ int main(int argc, char *argv[])
|
||||||
/* Make it use our session key! */
|
/* Make it use our session key! */
|
||||||
sphinx_path->session_key = &session_key;
|
sphinx_path->session_key = &session_key;
|
||||||
|
|
||||||
/* BOLT-onion-message #4:
|
/* BOLT #4:
|
||||||
* - SHOULD set `onion_message_packet` `len` to 1366 or 32834.
|
* - SHOULD set `onion_message_packet` `len` to 1366 or 32834.
|
||||||
*/
|
*/
|
||||||
op = create_onionpacket(tmpctx, sphinx_path, ROUTING_INFO_SIZE,
|
op = create_onionpacket(tmpctx, sphinx_path, ROUTING_INFO_SIZE,
|
||||||
|
|
|
@ -23,11 +23,8 @@ struct sockaddr_un;
|
||||||
* * version 3 ([prop224](https://gitweb.torproject.org/torspec.git/tree/proposals/224-rend-spec-ng.txt))
|
* * version 3 ([prop224](https://gitweb.torproject.org/torspec.git/tree/proposals/224-rend-spec-ng.txt))
|
||||||
* onion service addresses; Encodes:
|
* onion service addresses; Encodes:
|
||||||
* `[32:32_byte_ed25519_pubkey] || [2:checksum] || [1:version]`,
|
* `[32:32_byte_ed25519_pubkey] || [2:checksum] || [1:version]`,
|
||||||
* where `checksum = sha3(".onion checksum" || pubkey || version)[:2]`
|
* where `checksum = sha3(".onion checksum" || pubkey || version)[:2]`.
|
||||||
*/
|
* * `5`: DNS hostname; data = `[1:hostname_len][hostname_len:hostname][2:port]` (length up to 258)
|
||||||
|
|
||||||
/* BOLT-hostnames #7:
|
|
||||||
* * `5`: DNS hostname; data = `[byte:len][len*byte:hostname][u16:port]` (length up to 258)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define TOR_V2_ADDRLEN 10
|
#define TOR_V2_ADDRLEN 10
|
||||||
|
|
|
@ -349,7 +349,7 @@ static char *opt_add_addr_withtype(const char *arg,
|
||||||
arg + strlen("dns:"),
|
arg + strlen("dns:"),
|
||||||
arg);
|
arg);
|
||||||
}
|
}
|
||||||
/* BOLT-hostnames #7:
|
/* BOLT #7:
|
||||||
* The origin node:
|
* The origin node:
|
||||||
* ...
|
* ...
|
||||||
* - MUST NOT announce more than one `type 5` DNS hostname.
|
* - MUST NOT announce more than one `type 5` DNS hostname.
|
||||||
|
|
|
@ -93,7 +93,7 @@ static bool htlc_out_update_state(struct channel *channel,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BOLT-route-blinding #4:
|
/* BOLT #4:
|
||||||
* - if `blinding_point` is set in the incoming `update_add_htlc`:
|
* - if `blinding_point` is set in the incoming `update_add_htlc`:
|
||||||
* - MUST return an `invalid_onion_blinding` error.
|
* - MUST return an `invalid_onion_blinding` error.
|
||||||
* - if `current_blinding_point` is set in the onion payload and it is not the
|
* - if `current_blinding_point` is set in the onion payload and it is not the
|
||||||
|
|
|
@ -179,7 +179,7 @@ routehint_candidates(const tal_t *ctx,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BOLT-channel-type #2:
|
/* BOLT #2:
|
||||||
* - if `channel_type` has `option_scid_alias` set:
|
* - if `channel_type` has `option_scid_alias` set:
|
||||||
* - MUST NOT use the real `short_channel_id` in
|
* - MUST NOT use the real `short_channel_id` in
|
||||||
* BOLT 11 `r` fields.
|
* BOLT 11 `r` fields.
|
||||||
|
|
|
@ -176,7 +176,7 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
|
||||||
*/
|
*/
|
||||||
/* fall thru */
|
/* fall thru */
|
||||||
case WIRE_WARNING:
|
case WIRE_WARNING:
|
||||||
/* BOLT-warning #1:
|
/* BOLT #1:
|
||||||
* 1. type: 1 (`warning`)
|
* 1. type: 1 (`warning`)
|
||||||
* 2. data:
|
* 2. data:
|
||||||
* * [`channel_id`:`channel_id`]
|
* * [`channel_id`:`channel_id`]
|
||||||
|
|
Loading…
Add table
Reference in a new issue