mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
features: reorg, going to use elsewhere soon
This commit is contained in:
@@ -121,6 +121,16 @@ static const struct dependency feature_deps[] = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void clear_feature_bit(u8 *features, u32 bit)
|
||||||
|
{
|
||||||
|
size_t bytenum = bit / 8, bitnum = bit % 8, len = tal_count(features);
|
||||||
|
|
||||||
|
if (bytenum >= len)
|
||||||
|
return;
|
||||||
|
|
||||||
|
features[len - 1 - bytenum] &= ~(1 << bitnum);
|
||||||
|
}
|
||||||
|
|
||||||
static enum feature_copy_style feature_copy_style(u32 f, enum feature_place p)
|
static enum feature_copy_style feature_copy_style(u32 f, enum feature_place p)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(feature_styles); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(feature_styles); i++) {
|
||||||
@@ -204,16 +214,6 @@ static bool test_bit(const u8 *features, size_t byte, unsigned int bit)
|
|||||||
return features[tal_count(features) - 1 - byte] & (1 << (bit % 8));
|
return features[tal_count(features) - 1 - byte] & (1 << (bit % 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_feature_bit(u8 *features, u32 bit)
|
|
||||||
{
|
|
||||||
size_t bytenum = bit / 8, bitnum = bit % 8, len = tal_count(features);
|
|
||||||
|
|
||||||
if (bytenum >= len)
|
|
||||||
return;
|
|
||||||
|
|
||||||
features[len - 1 - bytenum] &= ~(1 << bitnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BOLT #7:
|
/* BOLT #7:
|
||||||
*
|
*
|
||||||
* - MUST set `features` based on what features were negotiated for this channel, according to [BOLT #9](09-features.md#assigned-features-flags)
|
* - MUST set `features` based on what features were negotiated for this channel, according to [BOLT #9](09-features.md#assigned-features-flags)
|
||||||
|
|||||||
Reference in New Issue
Block a user