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

Function main

channeld/test/run-commit_tx.c:491–1203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491int main(int argc, const char *argv[])
492{
493 common_setup(argv[0]);
494
495 struct bitcoin_outpoint funding;
496 struct amount_sat funding_amount, dust_limit;
497 u32 feerate_per_kw;
498 u16 to_self_delay;
499 /* x_ prefix means internal vars we used to derive spec */
500 struct privkey local_funding_privkey, x_remote_funding_privkey;
501 struct secret x_local_payment_basepoint_secret, x_remote_payment_basepoint_secret;
502 struct secret x_local_htlc_basepoint_secret, x_remote_htlc_basepoint_secret;
503 struct secret x_local_per_commitment_secret;
504 struct secret x_local_delayed_payment_basepoint_secret;
505 struct secret x_remote_revocation_basepoint_secret;
506 struct privkey local_htlcsecretkey, x_remote_htlcsecretkey;
507 struct privkey x_local_delayed_secretkey;
508 struct pubkey local_funding_pubkey, remote_funding_pubkey;
509 struct pubkey local_payment_basepoint, remote_payment_basepoint;
510 struct pubkey local_htlc_basepoint, remote_htlc_basepoint;
511 struct pubkey x_local_delayed_payment_basepoint;
512 struct pubkey x_remote_revocation_basepoint;
513 struct pubkey x_local_per_commitment_point;
514 struct pubkey localkey, remotekey, tmpkey;
515 struct pubkey local_htlckey, remote_htlckey;
516 struct pubkey local_delayedkey;
517 struct pubkey remote_revocation_key;
518 struct bitcoin_tx *tx, *tx2;
519 struct keyset keyset;
520 u8 *wscript;
521 u64 commitment_number, cn_obscurer;
522 struct amount_msat to_local, to_remote;
523 const struct htlc **htlcs, **htlc_map, **htlc_map2, **inv_htlcs;
524 bool option_anchor_outputs = false;
525 bool option_static_remotekey = false;
526
527 /* Allow us to check static-remotekey BOLT 3 vectors, too */
528 if (argv[1] && streq(argv[1], "--static-remotekey"))
529 option_static_remotekey = true;
530
531 chainparams = chainparams_for_network("bitcoin");
532
533 htlcs = setup_htlcs_0_to_4(tmpctx);
534 inv_htlcs = invert_htlcs(htlcs);
535
536#if DEVELOPER
537 /* This lets us match test vectors exactly. */
538 extern bool dev_no_grind;
539
540 dev_no_grind = true;
541#endif /* DEVELOPER */
542
543 /* BOLT #3:
544 *
545 * # Appendix C: Commitment and HTLC Transaction Test Vectors
546 *
547 * In the following:
548 * - *local* transactions are considered, which implies that all

Callers

nothing calls this directly

Calls 15

common_setupFunction · 0.85
chainparams_for_networkFunction · 0.85
setup_htlcs_0_to_4Function · 0.85
invert_htlcsFunction · 0.85
pubkey_from_secretFunction · 0.85
abortFunction · 0.85
derive_simple_privkeyFunction · 0.85
pubkey_from_privkeyFunction · 0.85
derive_simple_keyFunction · 0.85
bitcoin_redeem_2of2Function · 0.85
tal_hexFunction · 0.85
commit_txFunction · 0.85

Tested by

no test coverage detected