core-lightning/wire/peer_wire.h
Rusty Russell fed5a117e7 Update ccan/structeq.
structeq() is too dangerous: if a structure has padding, it can fail
silently.

The new ccan/structeq instead provides a macro to define foo_eq(),
which does the right thing in case of padding (which none of our
structures currently have anyway).

Upgrade ccan, and use it everywhere.  Except run-peer-wire.c, which
is only testing code and can use raw memcmp(): valgrind will tell us
if padding exists.

Interestingly, we still declared short_channel_id_eq, even though
we didn't define it any more!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-07-04 23:57:00 +02:00

41 lines
1.2 KiB
C

#ifndef LIGHTNING_WIRE_PEER_WIRE_H
#define LIGHTNING_WIRE_PEER_WIRE_H
#include "config.h"
#include <stdbool.h>
#include <wire/gen_peer_wire.h>
/* BOLT #1:
*
* A receiving node:
* - upon receiving a message of _odd_, unknown type:
* - MUST ignore the received message.
* - upon receiving a message of _even_, unknown type:
* - MUST fail the channels.
*/
/* Return true if it's an unknown ODD message. cursor is a tal ptr. */
bool is_unknown_msg_discardable(const u8 *cursor);
/* Return true if it's a message for gossipd. */
bool is_msg_for_gossipd(const u8 *cursor);
/* Extract channel_id from various packets, return true if possible. */
bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id);
/* BOLT #2:
*
* Only the least-significant bit of `channel_flags` is currently
* defined: `announce_channel`. This indicates whether the initiator
* of the funding flow wishes to advertise this channel publicly to
* the network, as detailed within [BOLT #7]
*/
#define CHANNEL_FLAGS_ANNOUNCE_CHANNEL 1
/* BOLT #2:
*
* The sending node:
*...
* - MUST set `funding_satoshis` to less than 2^24 satoshi.
*/
#define MAX_FUNDING_SATOSHI ((1 << 24) - 1)
#endif /* LIGHTNING_WIRE_PEER_WIRE_H */