bitcoin/short_channel_id: pass by copy everywhere.

It's a u64, we should pass by copy.  This is a big sweeping change,
but mainly mechanical (change one, compile, fix breakage, repeat).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2024-03-20 12:29:51 +10:30
parent 98f491a5d0
commit 9450d46db1
73 changed files with 355 additions and 319 deletions

View File

@@ -112,7 +112,7 @@ void json_add_sha256(struct json_stream *result UNNEEDED, const char *fieldname
/* Generated stub for json_add_short_channel_id */
void json_add_short_channel_id(struct json_stream *response UNNEEDED,
const char *fieldname UNNEEDED,
const struct short_channel_id *id UNNEEDED)
struct short_channel_id id UNNEEDED)
{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); }
/* Generated stub for json_add_string */
void json_add_string(struct json_stream *js UNNEEDED,
@@ -289,7 +289,7 @@ static void write_to_store(int store_fd, const u8 *msg)
static void update_connection(int store_fd,
const struct node_id *from,
const struct node_id *to,
const struct short_channel_id *scid,
struct short_channel_id scid,
struct amount_msat min,
struct amount_msat max,
u32 base_fee, s32 proportional_fee,
@@ -366,14 +366,14 @@ static struct short_channel_id_dir add_connection(int store_fd, char from, char
&dummy_sig, &dummy_sig,
/* features */ NULL,
&chainparams->genesis_blockhash,
&scidd.scid,
scidd.scid,
ids[0], ids[1],
&dummy_key, &dummy_key);
write_to_store(store_fd, msg);
msg = towire_gossip_store_channel_amount(tmpctx, capacity);
write_to_store(store_fd, msg);
update_connection(store_fd, &from_id, &to_id, &scidd.scid,
update_connection(store_fd, &from_id, &to_id, scidd.scid,
AMOUNT_MSAT(0),
amount_msat(capacity.satoshis * 1000),
base_fee, proportional_fee,
@@ -492,7 +492,7 @@ int main(int argc, char *argv[])
assert(tal_count(r) == ARRAY_SIZE(path));
for (size_t j = 0; j < ARRAY_SIZE(path); j++) {
assert(short_channel_id_eq(&r[j].scid, &path[j].scid));
assert(short_channel_id_eq(r[j].scid, path[j].scid));
assert(r[j].direction == path[j].dir);
}

View File

@@ -109,7 +109,7 @@ void json_add_sha256(struct json_stream *result UNNEEDED, const char *fieldname
/* Generated stub for json_add_short_channel_id */
void json_add_short_channel_id(struct json_stream *response UNNEEDED,
const char *fieldname UNNEEDED,
const struct short_channel_id *id UNNEEDED)
struct short_channel_id id UNNEEDED)
{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); }
/* Generated stub for json_add_string */
void json_add_string(struct json_stream *js UNNEEDED,
@@ -286,7 +286,7 @@ static void write_to_store(int store_fd, const u8 *msg)
static void update_connection(int store_fd,
const struct node_id *from,
const struct node_id *to,
const struct short_channel_id *scid,
struct short_channel_id scid,
struct amount_msat min,
struct amount_msat max,
u32 base_fee, s32 proportional_fee,
@@ -321,7 +321,7 @@ static void update_connection(int store_fd,
static void add_connection(int store_fd,
const struct node_id *from,
const struct node_id *to,
const struct short_channel_id *scid,
struct short_channel_id scid,
struct amount_msat min,
struct amount_msat max,
u32 base_fee, s32 proportional_fee,
@@ -402,7 +402,7 @@ int main(int argc, char *argv[])
if (!mk_short_channel_id(&scid, i, i-1, 0))
abort();
add_connection(store_fd, &ids[i-1], &ids[i], &scid,
add_connection(store_fd, &ids[i-1], &ids[i], scid,
AMOUNT_MSAT(0),
AMOUNT_MSAT(1000000 * 1000),
0, 0, 0);
@@ -415,7 +415,7 @@ int main(int argc, char *argv[])
continue;
if (!mk_short_channel_id(&scid, i, 1, 0))
abort();
add_connection(store_fd, &ids[1], &ids[i], &scid,
add_connection(store_fd, &ids[1], &ids[i], scid,
AMOUNT_MSAT(0),
AMOUNT_MSAT(1000000 * 1000),
1 << i, 0, 0);