2018-01-12 14:35:52 +01:00
|
|
|
#ifndef LIGHTNING_COMMON_FEATURES_H
|
|
|
|
#define LIGHTNING_COMMON_FEATURES_H
|
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
#include <ccan/tal/tal.h>
|
|
|
|
|
2018-03-13 16:41:55 +01:00
|
|
|
/* Returns true if we're OK with all these offered features. */
|
2018-09-29 02:57:01 +02:00
|
|
|
bool features_supported(const u8 *globalfeatures, const u8 *localfeatures);
|
2018-01-12 14:35:52 +01:00
|
|
|
|
2018-09-28 05:24:24 +02:00
|
|
|
/* For sending our features: tal_count() returns length. */
|
|
|
|
u8 *get_offered_globalfeatures(const tal_t *ctx);
|
|
|
|
u8 *get_offered_localfeatures(const tal_t *ctx);
|
2018-03-13 16:41:55 +01:00
|
|
|
|
|
|
|
/* Is this feature bit requested? (Either compulsory or optional) */
|
|
|
|
bool feature_offered(const u8 *features, size_t f);
|
|
|
|
|
2018-12-03 00:05:06 +01:00
|
|
|
/* Was this feature bit offered by them and us? */
|
|
|
|
bool local_feature_negotiated(const u8 *lfeatures, size_t f);
|
|
|
|
bool global_feature_negotiated(const u8 *gfeatures, size_t f);
|
|
|
|
|
2018-03-13 16:41:55 +01:00
|
|
|
#define COMPULSORY_FEATURE(x) (x)
|
|
|
|
#define OPTIONAL_FEATURE(x) ((x)+1)
|
|
|
|
|
|
|
|
/* BOLT #9:
|
|
|
|
*
|
|
|
|
* ## Assigned `localfeatures` flags
|
|
|
|
*...
|
|
|
|
* | Bits | Name |...
|
2018-06-28 04:01:21 +02:00
|
|
|
* | 0/1 | `option_data_loss_protect` |...
|
2018-03-13 16:41:55 +01:00
|
|
|
* | 3 | `initial_routing_sync` |...
|
|
|
|
* | 4/5 | `option_upfront_shutdown_script` |...
|
2018-06-04 06:17:25 +02:00
|
|
|
* | 6/7 | `gossip_queries` |...
|
2018-03-13 16:41:55 +01:00
|
|
|
*/
|
|
|
|
#define LOCAL_DATA_LOSS_PROTECT 0
|
|
|
|
#define LOCAL_INITIAL_ROUTING_SYNC 2
|
|
|
|
#define LOCAL_UPFRONT_SHUTDOWN_SCRIPT 4
|
2018-06-04 06:17:25 +02:00
|
|
|
#define LOCAL_GOSSIP_QUERIES 6
|
2018-01-12 14:35:52 +01:00
|
|
|
|
|
|
|
#endif /* LIGHTNING_COMMON_FEATURES_H */
|