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:
Rusty Russell 2024-07-09 18:07:44 +09:30 committed by Vincenzo Palazzo
parent f64d48e716
commit 4647f3c2a3
8 changed files with 8 additions and 14 deletions

View file

@ -109,7 +109,7 @@ bool onion_message_parse(const tal_t *ctx,
/* Now get onion shared secret and parse it. */
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) {
status_peer_debug(peer,
"onion_message_parse: can't process onionpacket ss=%s",

View file

@ -627,8 +627,7 @@ struct route_step *process_onionpacket(
const struct onionpacket *msg,
const struct secret *shared_secret,
const u8 *assocdata,
const size_t assocdatalen,
bool has_realm
const size_t assocdatalen
)
{
struct route_step *step = talz(ctx, struct route_step);

View file

@ -107,16 +107,13 @@ bool onion_shared_secret(
* @hoppayload: the per-hop payload destined for the processing node.
* @assocdata: associated data to commit to in HMACs
* @assocdatalen: length of the assocdata
* @has_realm: used for HTLCs, where first byte 0 is magical.
*/
struct route_step *process_onionpacket(
const tal_t * ctx,
const struct onionpacket *packet,
const struct secret *shared_secret,
const u8 *assocdata,
const size_t assocdatalen,
bool has_realm
);
const size_t assocdatalen);
/**
* serialize_onionpacket - Serialize an onionpacket to a buffer.

View file

@ -140,7 +140,7 @@ static u8 *next_onion(const tal_t *ctx, u8 *omsg,
assert(unblind_onion(&blinding, ecdh, &ephemeral, &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);
/* The raw payload is prepended with length in the modern onion. */

View file

@ -193,7 +193,7 @@ int main(int argc, char *argv[])
json_to_secret(json, t, &mykey);
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]));
if (rs->nextcase == ONION_FORWARD)
op = rs->next;

View file

@ -125,7 +125,7 @@ static struct route_step *decode_with_privkey(const tal_t *ctx, const u8 *onion,
errx(1, "Error creating shared secret.");
step = process_onionpacket(ctx, packet, &shared_secret, assocdata,
tal_bytelen(assocdata), true);
tal_bytelen(assocdata));
return step;
}

View file

@ -1337,7 +1337,7 @@ static bool peer_accepted_htlc(const tal_t *ctx,
rs = process_onionpacket(tmpctx, op, hin->shared_secret,
hin->payment_hash.u.u8,
sizeof(hin->payment_hash), true);
sizeof(hin->payment_hash));
if (!rs) {
*badonion = WIRE_INVALID_ONION_HMAC;
log_debug(channel->log,

View file

@ -915,9 +915,7 @@ struct route_step *process_onionpacket(
const struct onionpacket *packet UNNEEDED,
const struct secret *shared_secret UNNEEDED,
const u8 *assocdata UNNEEDED,
const size_t assocdatalen UNNEEDED,
bool has_realm
)
const size_t assocdatalen UNNEEDED)
{ fprintf(stderr, "process_onionpacket called!\n"); abort(); }
/* Generated stub for psbt_fixup */
const u8 *psbt_fixup(const tal_t *ctx UNNEEDED, const u8 *psbtblob UNNEEDED)