| 269 | } |
| 270 | |
| 271 | static bool print_blindedpaths(const char *fieldname, |
| 272 | struct blinded_path **paths, |
| 273 | struct blinded_payinfo **blindedpay) |
| 274 | { |
| 275 | for (size_t i = 0; i < tal_count(paths); i++) { |
| 276 | struct blinded_path_hop **p = paths[i]->path; |
| 277 | printf("%s %zu/%zu: first_path_key %s ", |
| 278 | fieldname, |
| 279 | i, tal_count(paths), |
| 280 | fmt_pubkey(tmpctx, &paths[i]->first_path_key)); |
| 281 | printf("first_node_id %s ", |
| 282 | fmt_sciddir_or_pubkey(tmpctx, &paths[i]->first_node_id)); |
| 283 | printf("path "); |
| 284 | for (size_t j = 0; j < tal_count(p); j++) { |
| 285 | printf(" %s:%s", |
| 286 | fmt_pubkey(tmpctx, |
| 287 | &p[j]->blinded_node_id), |
| 288 | tal_hex(tmpctx, p[j]->encrypted_recipient_data)); |
| 289 | } |
| 290 | if (i < tal_count(blindedpay)) { |
| 291 | printf(" blindedpay: fee=%u/%u,cltv=%u,min/max=%s/%s,features=%s", |
| 292 | blindedpay[i]->fee_base_msat, |
| 293 | blindedpay[i]->fee_proportional_millionths, |
| 294 | blindedpay[i]->cltv_expiry_delta, |
| 295 | fmt_amount_msat(tmpctx, blindedpay[i]->htlc_minimum_msat), |
| 296 | fmt_amount_msat(tmpctx, blindedpay[i]->htlc_maximum_msat), |
| 297 | tal_hex(tmpctx, blindedpay[i]->features)); |
| 298 | } |
| 299 | printf("\n"); |
| 300 | } |
| 301 | /* BOLT #12: |
| 302 | * - MUST reject the invoice if `invoice_blindedpay` does not |
| 303 | * contain exactly one `blinded_payinfo` per |
| 304 | * `invoice_paths`.`blinded_path`. |
| 305 | */ |
| 306 | if (blindedpay && tal_count(blindedpay) != tal_count(paths)) { |
| 307 | fprintf(stderr, "Expected %zu blindedpay fields, got %zu\n", |
| 308 | tal_count(paths), tal_count(blindedpay)); |
| 309 | return false; |
| 310 | } |
| 311 | return true; |
| 312 | } |
| 313 | |
| 314 | static bool print_signature(const char *messagename, |
| 315 | const char *fieldname, |
no test coverage detected