wireaddr: moves wireaddr_arr_contains to wireaddr.h

...So it can be reused somewhere else

Changelog-None
This commit is contained in:
Michael Schmoock 2022-05-08 12:09:32 +02:00 committed by Rusty Russell
parent de9bc172de
commit 55cf413fc3
3 changed files with 12 additions and 9 deletions

View File

@ -899,3 +899,12 @@ int wireaddr_cmp_type(const struct wireaddr *a,
return tal_bytelen(a_wire) - tal_bytelen(b_wire);
return cmp;
}
bool wireaddr_arr_contains(const struct wireaddr *was,
const struct wireaddr *wa)
{
for (size_t i = 0; i < tal_count(was); i++)
if (wireaddr_eq(&was[i], wa))
return true;
return false;
}

View File

@ -197,4 +197,7 @@ struct wireaddr *fromwire_wireaddr_array(const tal_t *ctx, const u8 *ser);
int wireaddr_cmp_type(const struct wireaddr *a,
const struct wireaddr *b, void *unused);
bool wireaddr_arr_contains(const struct wireaddr *was,
const struct wireaddr *wa);
#endif /* LIGHTNING_COMMON_WIREADDR_H */

View File

@ -20,15 +20,6 @@
#include <hsmd/hsmd_wiregen.h>
#include <wire/wire_sync.h>
static bool wireaddr_arr_contains(const struct wireaddr *was,
const struct wireaddr *wa)
{
for (size_t i = 0; i < tal_count(was); i++)
if (wireaddr_eq(&was[i], wa))
return true;
return false;
}
/* Create a node_announcement with the given signature. It may be NULL in the
* case we need to create a provisional announcement for the HSM to sign.
* This is called twice: once with the dummy signature to get it signed and a