| 630 | } |
| 631 | |
| 632 | struct bolt11 *new_bolt11(const tal_t *ctx, |
| 633 | const struct amount_msat *msat TAKES) |
| 634 | { |
| 635 | struct bolt11 *b11 = tal(ctx, struct bolt11); |
| 636 | |
| 637 | list_head_init(&b11->extra_fields); |
| 638 | b11->description = NULL; |
| 639 | b11->description_hash = NULL; |
| 640 | b11->fallbacks = NULL; |
| 641 | b11->routes = NULL; |
| 642 | b11->msat = NULL; |
| 643 | b11->expiry = DEFAULT_X; |
| 644 | b11->features = tal_arr(b11, u8, 0); |
| 645 | /* BOLT #11: |
| 646 | * - if the `c` field (`min_final_cltv_expiry_delta`) is not provided: |
| 647 | * - MUST use an expiry delta of at least 18 when making the payment |
| 648 | */ |
| 649 | b11->min_final_cltv_expiry = 18; |
| 650 | b11->payment_secret = NULL; |
| 651 | b11->metadata = NULL; |
| 652 | |
| 653 | if (msat) |
| 654 | b11->msat = tal_dup(b11, struct amount_msat, msat); |
| 655 | return b11; |
| 656 | } |
| 657 | |
| 658 | struct decoder { |
| 659 | /* What BOLT11 letter this is */ |