mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
wireaddr: add wireaddr_eq.
We can't STRUCTEQ_DEF() it since addrlen is variable, so open-code it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
0baa5f7071
commit
76e7f8aa5c
@@ -17,6 +17,15 @@
|
||||
#include <unistd.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
bool wireaddr_eq(const struct wireaddr *a, const struct wireaddr *b)
|
||||
{
|
||||
if (a->type != b->type)
|
||||
return false;
|
||||
if (a->port != b->port)
|
||||
return false;
|
||||
return memeq(a->addr, a->addrlen, b->addr, b->addrlen);
|
||||
}
|
||||
|
||||
/* Returns false if we didn't parse it, and *cursor == NULL if malformed. */
|
||||
bool fromwire_wireaddr(const u8 **cursor, size_t *max, struct wireaddr *addr)
|
||||
{
|
||||
|
||||
@@ -61,6 +61,8 @@ struct wireaddr {
|
||||
u16 port;
|
||||
};
|
||||
|
||||
bool wireaddr_eq(const struct wireaddr *a, const struct wireaddr *b);
|
||||
|
||||
/* We use wireaddr to tell gossipd both what to listen on, and what to
|
||||
* announce */
|
||||
enum addr_listen_announce {
|
||||
|
||||
Reference in New Issue
Block a user