mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
common: don't pass (unused) has_realm parameter to process_onionpacket.
This was when we handled pre-TLV onions where the first byte was 0. We haven't done that for a while: you can tell, because process_onionpacket doesn't use the parameter at all! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
f64d48e716
commit
4647f3c2a3
8 changed files with 8 additions and 14 deletions
|
@ -109,7 +109,7 @@ bool onion_message_parse(const tal_t *ctx,
|
||||||
|
|
||||||
/* Now get onion shared secret and parse it. */
|
/* Now get onion shared secret and parse it. */
|
||||||
ecdh(&ephemeral, &onion_ss);
|
ecdh(&ephemeral, &onion_ss);
|
||||||
rs = process_onionpacket(tmpctx, op, &onion_ss, NULL, 0, false);
|
rs = process_onionpacket(tmpctx, op, &onion_ss, NULL, 0);
|
||||||
if (!rs) {
|
if (!rs) {
|
||||||
status_peer_debug(peer,
|
status_peer_debug(peer,
|
||||||
"onion_message_parse: can't process onionpacket ss=%s",
|
"onion_message_parse: can't process onionpacket ss=%s",
|
||||||
|
|
|
@ -627,8 +627,7 @@ struct route_step *process_onionpacket(
|
||||||
const struct onionpacket *msg,
|
const struct onionpacket *msg,
|
||||||
const struct secret *shared_secret,
|
const struct secret *shared_secret,
|
||||||
const u8 *assocdata,
|
const u8 *assocdata,
|
||||||
const size_t assocdatalen,
|
const size_t assocdatalen
|
||||||
bool has_realm
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct route_step *step = talz(ctx, struct route_step);
|
struct route_step *step = talz(ctx, struct route_step);
|
||||||
|
|
|
@ -107,16 +107,13 @@ bool onion_shared_secret(
|
||||||
* @hoppayload: the per-hop payload destined for the processing node.
|
* @hoppayload: the per-hop payload destined for the processing node.
|
||||||
* @assocdata: associated data to commit to in HMACs
|
* @assocdata: associated data to commit to in HMACs
|
||||||
* @assocdatalen: length of the assocdata
|
* @assocdatalen: length of the assocdata
|
||||||
* @has_realm: used for HTLCs, where first byte 0 is magical.
|
|
||||||
*/
|
*/
|
||||||
struct route_step *process_onionpacket(
|
struct route_step *process_onionpacket(
|
||||||
const tal_t * ctx,
|
const tal_t * ctx,
|
||||||
const struct onionpacket *packet,
|
const struct onionpacket *packet,
|
||||||
const struct secret *shared_secret,
|
const struct secret *shared_secret,
|
||||||
const u8 *assocdata,
|
const u8 *assocdata,
|
||||||
const size_t assocdatalen,
|
const size_t assocdatalen);
|
||||||
bool has_realm
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* serialize_onionpacket - Serialize an onionpacket to a buffer.
|
* serialize_onionpacket - Serialize an onionpacket to a buffer.
|
||||||
|
|
|
@ -140,7 +140,7 @@ static u8 *next_onion(const tal_t *ctx, u8 *omsg,
|
||||||
assert(unblind_onion(&blinding, ecdh, &ephemeral, &ss));
|
assert(unblind_onion(&blinding, ecdh, &ephemeral, &ss));
|
||||||
|
|
||||||
ecdh(&ephemeral, &onion_ss);
|
ecdh(&ephemeral, &onion_ss);
|
||||||
rs = process_onionpacket(tmpctx, op, &onion_ss, NULL, 0, false);
|
rs = process_onionpacket(tmpctx, op, &onion_ss, NULL, 0);
|
||||||
assert(rs);
|
assert(rs);
|
||||||
|
|
||||||
/* The raw payload is prepended with length in the modern onion. */
|
/* The raw payload is prepended with length in the modern onion. */
|
||||||
|
|
|
@ -193,7 +193,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
json_to_secret(json, t, &mykey);
|
json_to_secret(json, t, &mykey);
|
||||||
test_ecdh(&op->ephemeralkey, &ss);
|
test_ecdh(&op->ephemeralkey, &ss);
|
||||||
rs = process_onionpacket(tmpctx, op, &ss, assoc_data, tal_bytelen(assoc_data), true);
|
rs = process_onionpacket(tmpctx, op, &ss, assoc_data, tal_bytelen(assoc_data));
|
||||||
assert(tal_arr_eq(rs->raw_payload, payloads[i]));
|
assert(tal_arr_eq(rs->raw_payload, payloads[i]));
|
||||||
if (rs->nextcase == ONION_FORWARD)
|
if (rs->nextcase == ONION_FORWARD)
|
||||||
op = rs->next;
|
op = rs->next;
|
||||||
|
|
|
@ -125,7 +125,7 @@ static struct route_step *decode_with_privkey(const tal_t *ctx, const u8 *onion,
|
||||||
errx(1, "Error creating shared secret.");
|
errx(1, "Error creating shared secret.");
|
||||||
|
|
||||||
step = process_onionpacket(ctx, packet, &shared_secret, assocdata,
|
step = process_onionpacket(ctx, packet, &shared_secret, assocdata,
|
||||||
tal_bytelen(assocdata), true);
|
tal_bytelen(assocdata));
|
||||||
return step;
|
return step;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1337,7 +1337,7 @@ static bool peer_accepted_htlc(const tal_t *ctx,
|
||||||
|
|
||||||
rs = process_onionpacket(tmpctx, op, hin->shared_secret,
|
rs = process_onionpacket(tmpctx, op, hin->shared_secret,
|
||||||
hin->payment_hash.u.u8,
|
hin->payment_hash.u.u8,
|
||||||
sizeof(hin->payment_hash), true);
|
sizeof(hin->payment_hash));
|
||||||
if (!rs) {
|
if (!rs) {
|
||||||
*badonion = WIRE_INVALID_ONION_HMAC;
|
*badonion = WIRE_INVALID_ONION_HMAC;
|
||||||
log_debug(channel->log,
|
log_debug(channel->log,
|
||||||
|
|
|
@ -915,9 +915,7 @@ struct route_step *process_onionpacket(
|
||||||
const struct onionpacket *packet UNNEEDED,
|
const struct onionpacket *packet UNNEEDED,
|
||||||
const struct secret *shared_secret UNNEEDED,
|
const struct secret *shared_secret UNNEEDED,
|
||||||
const u8 *assocdata UNNEEDED,
|
const u8 *assocdata UNNEEDED,
|
||||||
const size_t assocdatalen UNNEEDED,
|
const size_t assocdatalen UNNEEDED)
|
||||||
bool has_realm
|
|
||||||
)
|
|
||||||
{ fprintf(stderr, "process_onionpacket called!\n"); abort(); }
|
{ fprintf(stderr, "process_onionpacket called!\n"); abort(); }
|
||||||
/* Generated stub for psbt_fixup */
|
/* Generated stub for psbt_fixup */
|
||||||
const u8 *psbt_fixup(const tal_t *ctx UNNEEDED, const u8 *psbtblob UNNEEDED)
|
const u8 *psbt_fixup(const tal_t *ctx UNNEEDED, const u8 *psbtblob UNNEEDED)
|
||||||
|
|
Loading…
Add table
Reference in a new issue