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

Function steal_htlc

onchaind/onchaind.c:2512–2534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2510}
2511
2512static void steal_htlc(struct tracked_output *out)
2513{
2514 const u8 *msg;
2515 u8 der[PUBKEY_CMPR_LEN];
2516
2517 /* BOLT #3:
2518 *
2519 * If a revoked commitment transaction is published, the remote node can
2520 * spend this output immediately with the following witness:
2521 *
2522 * <revocation_sig> <revocationpubkey>
2523 */
2524 pubkey_to_der(der, &keyset->self_revocation_key);
2525
2526 msg = towire_onchaind_spend_penalty(NULL,
2527 &out->outpoint, out->sat,
2528 remote_per_commitment_secret,
2529 tal_dup_arr(tmpctx, u8, der, ARRAY_SIZE(der), 0),
2530 out->wscript);
2531
2532 /* Spend this immediately. */
2533 propose_immediate_resolution(out, take(msg), OUR_PENALTY_TX);
2534}
2535
2536/* Tell wallet that we have discovered a UTXO from a to-remote output,
2537 * which it can spend with a little additional info we give here. */

Callers 1

handle_their_cheatFunction · 0.85

Calls 3

pubkey_to_derFunction · 0.85

Tested by

no test coverage detected