| 111 | } |
| 112 | |
| 113 | int main(int argc, char *argv[]) |
| 114 | { |
| 115 | struct tlv_offer *offer; |
| 116 | struct secret alice; |
| 117 | char *str; |
| 118 | |
| 119 | common_setup(argv[0]); |
| 120 | |
| 121 | offer = tlv_offer_new(tmpctx); |
| 122 | /* BOLT #12: |
| 123 | * A writer of an offer: |
| 124 | * - MUST NOT set any TLV fields outside the inclusive ranges: 1 to 79 and 1000000000 to 1999999999. |
| 125 | * - if the chain for the invoice is not solely bitcoin: |
| 126 | * - MUST specify `offer_chains` the offer is valid for. |
| 127 | * - otherwise: |
| 128 | * - SHOULD omit `offer_chains`, implying that bitcoin is only chain. |
| 129 | * - if a specific minimum `offer_amount` is required for successful payment: |
| 130 | * - MUST set `offer_amount` to the amount expected (per item). |
| 131 | * - MUST set `offer_amount` greater than zero. |
| 132 | * - if the currency for `offer_amount` is that of all entries in `chains`: |
| 133 | * - MUST specify `offer_amount` in multiples of the minimum lightning-payable unit |
| 134 | * (e.g. milli-satoshis for bitcoin). |
| 135 | * - otherwise: |
| 136 | * - MUST specify `offer_currency` `iso4217` as an ISO 4217 three-letter code. |
| 137 | * - MUST specify `offer_amount` in the currency unit adjusted by the ISO 4217 |
| 138 | * exponent (e.g. USD cents). |
| 139 | * - MUST set `offer_description` to a complete description of the purpose |
| 140 | * of the payment. |
| 141 | * - otherwise: |
| 142 | * - MUST NOT set `offer_amount` |
| 143 | * - MUST NOT set `offer_currency` |
| 144 | * - MAY set `offer_description` |
| 145 | * - MAY set `offer_metadata` for its own use. |
| 146 | * - if it supports bolt12 offer features: |
| 147 | * - MUST set `offer_features`.`features` to the bitmap of bolt12 features. |
| 148 | * - if the offer expires: |
| 149 | * - MUST set `offer_absolute_expiry` `seconds_from_epoch` to the number of seconds |
| 150 | * after midnight 1 January 1970, UTC that invoice_request should not be |
| 151 | * attempted. |
| 152 | * - if it is connected only by private channels: |
| 153 | * - MUST include `offer_paths` containing one or more paths to the node from |
| 154 | * publicly reachable nodes. |
| 155 | * - otherwise: |
| 156 | * - MAY include `offer_paths`. |
| 157 | * - if it includes `offer_paths`: |
| 158 | * - MAY set `offer_issuer_id`. |
| 159 | * - otherwise: |
| 160 | * - MUST set `offer_issuer_id` to the node's public key to request the invoice from. |
| 161 | * - if it sets `offer_issuer`: |
| 162 | * - SHOULD set it to identify the issuer of the invoice clearly. |
| 163 | * - if it includes a domain name: |
| 164 | * - SHOULD begin it with either user@domain or domain |
| 165 | * - MAY follow with a space and more text |
| 166 | * - if it can supply more than one item for a single invoice: |
| 167 | * - if the maximum quantity is known: |
| 168 | * - MUST set that maximum in `offer_quantity_max`. |
| 169 | * - MUST NOT set `offer_quantity_max` to 0. |
| 170 | * - otherwise: |
nothing calls this directly
no test coverage detected