mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-03 22:34:21 +01:00
common: make BOLT11 use the normal feature array.
This was decided at a recent spec meeting: in particular, mpp and var_onion_optin options will be used here. We enhanced "features_supported" into "features_unsupported" so it can return the first un-handlable bit number. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -84,17 +84,17 @@ int main(void)
|
||||
|
||||
/* We always support no features. */
|
||||
memset(bits, 0, tal_count(bits));
|
||||
assert(features_supported(bits));
|
||||
assert(features_unsupported(bits) == -1);
|
||||
|
||||
/* We must support our own features. */
|
||||
lf = get_offered_features(tmpctx);
|
||||
assert(features_supported(lf));
|
||||
assert(features_unsupported(lf) == -1);
|
||||
|
||||
/* We can add random odd features, no problem. */
|
||||
for (size_t i = 1; i < 16; i += 2) {
|
||||
bits = tal_dup_arr(tmpctx, u8, lf, tal_count(lf), 0);
|
||||
set_feature_bit(&bits, i);
|
||||
assert(features_supported(bits));
|
||||
assert(features_unsupported(bits) == -1);
|
||||
}
|
||||
|
||||
/* We can't add random even features. */
|
||||
@@ -104,9 +104,9 @@ int main(void)
|
||||
|
||||
/* Special case for missing compulsory feature */
|
||||
if (i == 2) {
|
||||
assert(!features_supported(bits));
|
||||
assert(features_unsupported(bits) == i);
|
||||
} else {
|
||||
assert(features_supported(bits)
|
||||
assert((features_unsupported(bits) == -1)
|
||||
== feature_supported(i, our_features,
|
||||
ARRAY_SIZE(our_features)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user