features: Add featurebits_or helper to combine two featurebitstrings

We will be doing this when collecting featurebits from the plugins, so make
this a reusable function.
This commit is contained in:
Christian Decker
2020-01-30 15:40:09 +01:00
committed by Rusty Russell
parent ea62d97879
commit 9b976da3bc
4 changed files with 49 additions and 4 deletions

View File

@@ -87,10 +87,7 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
/* The globalfeatures field is now unused, but there was a
* window where it was: combine the two. */
for (size_t i = 0; i < tal_bytelen(globalfeatures) * 8; i++) {
if (feature_is_set(globalfeatures, i))
set_feature_bit(&features, i);
}
features = featurebits_or(tmpctx, take(features), globalfeatures);
/* BOLT #1:
*