short_channel_id: just use structeq.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-03-01 19:53:16 +10:30 committed by Christian Decker
parent affc1be4d6
commit c5d41a23d7
7 changed files with 10 additions and 18 deletions

View File

@ -36,12 +36,6 @@ void mk_short_channel_id(struct short_channel_id *scid,
bool short_channel_id_from_str(const char *str, size_t strlen,
struct short_channel_id *dst);
static inline bool short_channel_id_eq(const struct short_channel_id *a,
const struct short_channel_id *b)
{
return a->u64 == b->u64;
}
/* Fast, platform dependent, way to convert from a short_channel_id to u64 */
static inline u64 short_channel_id_to_uint(const struct short_channel_id *scid)
{

View File

@ -533,8 +533,8 @@ static void check_short_ids_match(struct peer *peer)
assert(peer->have_sigs[LOCAL]);
assert(peer->have_sigs[REMOTE]);
if (!short_channel_id_eq(&peer->short_channel_ids[LOCAL],
&peer->short_channel_ids[REMOTE]))
if (!structeq(&peer->short_channel_ids[LOCAL],
&peer->short_channel_ids[REMOTE]))
peer_failed(&peer->cs, peer->gossip_index,
&peer->channel_id,
"We disagree on short_channel_ids:"

View File

@ -733,8 +733,7 @@ static void handle_get_update(struct peer *peer, const u8 *msg)
}
for (i = 0; i < tal_count(us->out); i++) {
if (!short_channel_id_eq(&us->out[i]->short_channel_id,
&schanid))
if (!structeq(&us->out[i]->short_channel_id, &schanid))
continue;
update = us->out[i]->channel_update;
@ -1093,8 +1092,7 @@ static struct io_plan *getchannels_req(struct io_conn *conn, struct daemon *daem
while (n != NULL) {
for (j=0; j<tal_count(n->out); j++){
if (scid &&
!short_channel_id_eq(scid,
&n->out[j]->short_channel_id)) {
!structeq(scid, &n->out[j]->short_channel_id)) {
continue;
}
tal_resize(&entries, num_chans + 1);

View File

@ -1194,7 +1194,7 @@ get_out_node_connection_of(const struct node *node,
int i;
for (i = 0; i < tal_count(node->out); ++i) {
if (short_channel_id_eq(&node->out[i]->short_channel_id, short_channel_id))
if (structeq(&node->out[i]->short_channel_id, short_channel_id))
return node->out[i];
}

View File

@ -1069,7 +1069,7 @@ static void json_dev_forget_channel(struct command *cmd, const char *buffer,
if (scidtok) {
if (!channel->scid)
continue;
if (!short_channel_id_eq(channel->scid, &scid))
if (!structeq(channel->scid, &scid))
continue;
}
if (forget->channel) {

View File

@ -610,7 +610,7 @@ static bool channelseq(struct channel *c1, struct channel *c2)
CHECK(c1->peer == c2->peer);
CHECK(c1->their_shachain.id == c2->their_shachain.id);
CHECK_MSG(pubkey_eq(&p1->id, &p2->id), "NodeIDs do not match");
CHECK((c1->scid == NULL && c2->scid == NULL) || short_channel_id_eq(c1->scid, c2->scid));
CHECK((c1->scid == NULL && c2->scid == NULL) || structeq(c1->scid, c2->scid));
CHECK(c1->our_msatoshi == c2->our_msatoshi);
CHECK((c1->remote_shutdown_scriptpubkey == NULL && c2->remote_shutdown_scriptpubkey == NULL) || memeq(
c1->remote_shutdown_scriptpubkey,

View File

@ -704,7 +704,7 @@ static bool channel_announcement_eq(const struct msg_channel_announcement *a,
return eq_upto(a, b, features)
&& eq_var(a, b, features)
&& eq_field(a, b, chain_hash)
&& short_channel_id_eq(&a->short_channel_id, &b->short_channel_id)
&& structeq(&a->short_channel_id, &b->short_channel_id)
&& eq_between(a, b, node_id_1, bitcoin_key_2);
}
@ -718,7 +718,7 @@ static bool announcement_signatures_eq(const struct msg_announcement_signatures
const struct msg_announcement_signatures *b)
{
return eq_upto(a, b, short_channel_id) &&
short_channel_id_eq(&a->short_channel_id, &b->short_channel_id);
structeq(&a->short_channel_id, &b->short_channel_id);
}
static bool update_fail_htlc_eq(const struct msg_update_fail_htlc *a,
@ -804,7 +804,7 @@ static bool channel_update_eq(const struct msg_channel_update *a,
const struct msg_channel_update *b)
{
return eq_upto(a, b, short_channel_id) &&
short_channel_id_eq(&a->short_channel_id, &b->short_channel_id);
structeq(&a->short_channel_id, &b->short_channel_id);
}
static bool accept_channel_eq(const struct msg_accept_channel *a,