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

Function handle_their_unilateral

onchaind/onchaind.c:3411–3740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3409}
3410
3411static void handle_their_unilateral(const struct tx_parts *tx,
3412 u32 tx_blockheight,
3413 const struct pubkey *this_remote_per_commitment_point,
3414 const struct basepoints basepoints[NUM_SIDES],
3415 const enum side opener,
3416 struct tracked_output **outs)
3417{
3418 u8 **htlc_scripts;
3419 u8 *remote_wscript, *script[NUM_SIDES], *anchor[NUM_SIDES];
3420 struct keyset *ks;
3421 size_t i;
3422 struct htlcs_info *htlcs_info;
3423
3424 htlcs_info = init_reply(tx, "Tracking their unilateral close");
3425 onchain_annotate_txin(&tx->txid, 0, TX_CHANNEL_UNILATERAL | TX_THEIRS);
3426
3427 /* HSM can't derive this. */
3428 remote_per_commitment_point = this_remote_per_commitment_point;
3429
3430 /* BOLT #5:
3431 *
3432 * # Unilateral Close Handling: Remote Commitment Transaction
3433 *
3434 * The *remote node's* commitment transaction *resolves* the funding
3435 * transaction output.
3436 *
3437 * There are no delays constraining node behavior in this case, so
3438 * it's simpler for a node to handle than the case in which it
3439 * discovers its local commitment transaction (see [Unilateral Close
3440 * Handling: Local Commitment Transaction]
3441 */
3442 resolved_by_other(outs[0], &tx->txid, THEIR_UNILATERAL);
3443
3444 status_debug("Deriving keyset %"PRIu64
3445 ": per_commit_point=%s"
3446 " self_payment_basepoint=%s"
3447 " other_payment_basepoint=%s"
3448 " self_htlc_basepoint=%s"
3449 " other_htlc_basepoint=%s"
3450 " self_delayed_basepoint=%s"
3451 " other_revocation_basepoint=%s",
3452 commit_num,
3453 type_to_string(tmpctx, struct pubkey,
3454 remote_per_commitment_point),
3455 type_to_string(tmpctx, struct pubkey,
3456 &basepoints[REMOTE].payment),
3457 type_to_string(tmpctx, struct pubkey,
3458 &basepoints[LOCAL].payment),
3459 type_to_string(tmpctx, struct pubkey,
3460 &basepoints[REMOTE].htlc),
3461 type_to_string(tmpctx, struct pubkey,
3462 &basepoints[LOCAL].htlc),
3463 type_to_string(tmpctx, struct pubkey,
3464 &basepoints[REMOTE].delayed_payment),
3465 type_to_string(tmpctx, struct pubkey,
3466 &basepoints[LOCAL].revocation));
3467
3468 /* keyset is const, we need a non-const ptr to set it up */

Callers 1

mainFunction · 0.85

Calls 15

init_replyFunction · 0.85
resolved_by_otherFunction · 0.85
derive_htlc_scriptsFunction · 0.85
get_anchor_scriptpubkeysFunction · 0.85
tal_hexstrFunction · 0.85
scriptpubkey_to_remoteFunction · 0.85
tal_hexFunction · 0.85
new_tracked_outputFunction · 0.85
ignore_outputFunction · 0.85
wally_tx_output_scripteqFunction · 0.85
their_unilateral_localFunction · 0.85

Tested by

no test coverage detected