diff --git a/common/features.c b/common/features.c index 3a52ebf94..426cf8157 100644 --- a/common/features.c +++ b/common/features.c @@ -133,3 +133,18 @@ bool features_supported(const u8 *globalfeatures, const u8 *localfeatures) ARRAY_SIZE(our_localfeatures)); } +bool local_feature_negotiated(const u8 *lfeatures, size_t f) +{ + if (!feature_offered(lfeatures, f)) + return false; + return feature_supported(f, our_localfeatures, + ARRAY_SIZE(our_localfeatures)); +} + +bool global_feature_negotiated(const u8 *gfeatures, size_t f) +{ + if (!feature_offered(gfeatures, f)) + return false; + return feature_supported(f, our_globalfeatures, + ARRAY_SIZE(our_globalfeatures)); +} diff --git a/common/features.h b/common/features.h index 1cda1d168..5ef524f66 100644 --- a/common/features.h +++ b/common/features.h @@ -14,6 +14,10 @@ u8 *get_offered_localfeatures(const tal_t *ctx); /* Is this feature bit requested? (Either compulsory or optional) */ bool feature_offered(const u8 *features, size_t f); +/* 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); + #define COMPULSORY_FEATURE(x) (x) #define OPTIONAL_FEATURE(x) ((x)+1)