MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

wire/test/run-tlvstream.c:454–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452}
453
454int main(int argc, char *argv[])
455{
456 common_setup(argv[0]);
457
458 if (!pubkey_from_hexstr("023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb", 66, &tlv3_node_id.node_id))
459 abort();
460 /* gcc 4.8 doesn't like this initialized statically. */
461 tlv3_node_id.amount_msat_1 = AMOUNT_MSAT(1);
462 tlv3_node_id.amount_msat_2 = AMOUNT_MSAT(2);
463
464 for (size_t i = 0; i < ARRAY_SIZE(invalid_streams_either); i++) {
465 struct tlv_n1 *tlv_n1;
466 struct tlv_n2 *tlv_n2;
467 const u8 *p, *orig_p;
468 size_t max;
469
470 orig_p = stream(tmpctx, invalid_streams_either[i].hex);
471 max = tal_count(orig_p);
472 p = orig_p;
473 tlv_n1 = fromwire_tlv_n1(tmpctx, &p, &max);
474 assert(!tlv_n1 && !p);
475 assert(strstr(invalid_streams_either[i].reason, reason));
476 max = tal_count(orig_p);
477 p = orig_p;
478 tlv_n2 = fromwire_tlv_n2(tmpctx, &p, &max);
479 assert(!tlv_n2 && !p);
480 assert(strstr(invalid_streams_either[i].reason, reason));
481 }
482
483 for (size_t i = 0; i < ARRAY_SIZE(invalid_streams_n1); i++) {
484 struct tlv_n1 *tlv_n1;
485 const u8 *p;
486 size_t max;
487
488 p = stream(tmpctx, invalid_streams_n1[i].hex);
489 max = tal_count(p);
490 tlv_n1 = fromwire_tlv_n1(tmpctx, &p, &max);
491 assert(!tlv_n1 && !p);
492 assert(strstr(invalid_streams_n1[i].reason, reason));
493 }
494
495 for (size_t i = 0; i < ARRAY_SIZE(invalid_streams_n1_combo); i++) {
496 struct tlv_n1 *tlv_n1;
497 const u8 *p;
498 size_t max;
499
500 p = stream(tmpctx, invalid_streams_n1_combo[i].hex);
501 max = tal_count(p);
502 tlv_n1 = fromwire_tlv_n1(tmpctx, &p, &max);
503 assert(!tlv_n1 && !p);
504 assert(strstr(invalid_streams_n1_combo[i].reason, reason));
505 }
506
507 for (size_t i = 0; i < ARRAY_SIZE(invalid_streams_n2_combo); i++) {
508 struct tlv_n2 *tlv_n2;
509 const u8 *p;
510 size_t max;
511

Callers

nothing calls this directly

Calls 10

common_setupFunction · 0.85
pubkey_from_hexstrFunction · 0.85
abortFunction · 0.85
streamFunction · 0.85
tlv_n1_eqFunction · 0.85
ignored_fieldsFunction · 0.85
memeqFunction · 0.85
stream2Function · 0.85
pull_typeFunction · 0.85
common_shutdownFunction · 0.85

Tested by

no test coverage detected