| 216 | } |
| 217 | |
| 218 | struct tlv_invoice_request *invrequest_decode(const tal_t *ctx, |
| 219 | const char *b12, size_t b12len, |
| 220 | const struct feature_set *our_features, |
| 221 | const struct chainparams *must_be_chain, |
| 222 | char **fail) |
| 223 | { |
| 224 | struct tlv_invoice_request *invrequest; |
| 225 | const u8 *data; |
| 226 | size_t dlen; |
| 227 | |
| 228 | data = string_to_data(tmpctx, b12, b12len, "lnr", &dlen, fail); |
| 229 | if (!data) |
| 230 | return NULL; |
| 231 | |
| 232 | invrequest = fromwire_tlv_invoice_request(ctx, &data, &dlen); |
| 233 | if (!invrequest) { |
| 234 | *fail = tal_fmt(ctx, "invalid invoice_request data"); |
| 235 | return NULL; |
| 236 | } |
| 237 | |
| 238 | *fail = check_features_and_chain(ctx, |
| 239 | our_features, must_be_chain, |
| 240 | invrequest->features, |
| 241 | invrequest->chain, 1); |
| 242 | if (*fail) |
| 243 | return tal_free(invrequest); |
| 244 | |
| 245 | return invrequest; |
| 246 | } |
| 247 | |
| 248 | char *invoice_encode(const tal_t *ctx, const struct tlv_invoice *invoice_tlv) |
| 249 | { |
no test coverage detected