Browse Source

BOLT: Update to include BOLT11 features.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
8fdfdcec74
  1. 2
      Makefile
  2. 18
      common/bolt11.c

2
Makefile

@ -15,7 +15,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs # Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/ BOLTDIR := ../lightning-rfc/
BOLTVERSION := aba7a8fe46735cb6c15632935f5e442b2fc7f26f BOLTVERSION := 03fd18e5bc604213a0f4514982cb6045bdb4c5b2
-include config.vars -include config.vars

18
common/bolt11.c

@ -446,9 +446,9 @@ static void shift_bitmap_down(u8 *bitmap, size_t bits)
assert(prev == 0); assert(prev == 0);
} }
/* BOLT-a76d61dc9893eec75b2e9c4a361354c356c46894 #11: /* BOLT #11:
* *
* `9` (5): `data_length` variable. One or more bytes containing features * `9` (5): `data_length` variable. One or more 5-bit values containing features
* supported or required for receiving this payment. * supported or required for receiving this payment.
* See [Feature Bits](#feature-bits). * See [Feature Bits](#feature-bits).
*/ */
@ -467,14 +467,14 @@ static char *decode_9(struct bolt11 *b11,
shift_bitmap_down(b11->features, shift_bitmap_down(b11->features,
flen * 8 - data_length * 5); flen * 8 - data_length * 5);
/* BOLT-a76d61dc9893eec75b2e9c4a361354c356c46894 #11: /* BOLT #11:
* *
* - if the `9` field contains unknown _odd_ bits that are non-zero: * - if the `9` field contains unknown _odd_ bits that are non-zero:
* - MUST ignore the bit. * - MUST ignore the bit.
* - if the `9` field contains unknown _even_ bits that are non-zero: * - if the `9` field contains unknown _even_ bits that are non-zero:
* - MUST fail. * - MUST fail the payment.
*/ */
/* BOLT-a76d61dc9893eec75b2e9c4a361354c356c46894 #11: /* BOLT #11:
* The field is big-endian. The least-significant bit is numbered 0, * The field is big-endian. The least-significant bit is numbered 0,
* which is _even_, and the next most significant bit is numbered 1, * which is _even_, and the next most significant bit is numbered 1,
* which is _odd_. */ * which is _odd_. */
@ -806,7 +806,11 @@ static void push_field(u5 **data, char type, const void *src, size_t nbits)
/* BOLT #11: /* BOLT #11:
* *
* SHOULD use the minimum `data_length` possible for `x` and `c` fields. * - if `x` is included:
* - SHOULD use the minimum `data_length` possible.
*...
* - if `c` is included:
* - SHOULD use the minimum `data_length` possible.
*/ */
static void push_varlen_field(u5 **data, char type, u64 val) static void push_varlen_field(u5 **data, char type, u64 val)
{ {
@ -924,7 +928,7 @@ static void maybe_encode_9(u5 **data, const u8 *features)
set_feature_bit(&f5, (i / 5) * 8 + (i % 5)); set_feature_bit(&f5, (i / 5) * 8 + (i % 5));
} }
/* BOLT-a76d61dc9893eec75b2e9c4a361354c356c46894 #11: /* BOLT #11:
* *
* - if `9` contains non-zero bits: * - if `9` contains non-zero bits:
* - SHOULD use the minimum `data_length` possible. * - SHOULD use the minimum `data_length` possible.

Loading…
Cancel
Save