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

Function main

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

Source from the content-addressed store, hash-verified

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

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
fmt_privkeyFunction · 0.85
fmt_secretFunction · 0.85
pubkey_from_secretFunction · 0.85
abortFunction · 0.85
fmt_pubkeyFunction · 0.85
derive_simple_privkeyFunction · 0.85
pubkey_from_privkeyFunction · 0.85
derive_simple_keyFunction · 0.85

Tested by

no test coverage detected