mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
htlc_tx: use keyset abstraction.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -208,6 +208,7 @@ static void report_htlcs(const struct bitcoin_tx *tx,
|
||||
struct sha256_double txid;
|
||||
struct bitcoin_tx **htlc_tx;
|
||||
secp256k1_ecdsa_signature *remotesig;
|
||||
struct keyset keyset;
|
||||
u8 **wscript;
|
||||
|
||||
htlc_tx = tal_arrz(tmpctx, struct bitcoin_tx *, tal_count(htlc_map));
|
||||
@@ -224,6 +225,13 @@ static void report_htlcs(const struct bitcoin_tx *tx,
|
||||
|
||||
printf("num_htlcs: %zu\n", n);
|
||||
|
||||
/* FIXME: naming here is kind of backwards: local revocation key
|
||||
* is derived from remote revocation basepoint, but it's local */
|
||||
keyset.self_revocation_key = *remote_revocation_key;
|
||||
keyset.self_delayed_payment_key = *local_delayedkey;
|
||||
keyset.self_payment_key = *localkey;
|
||||
keyset.other_payment_key = *remotekey;
|
||||
|
||||
for (i = 0; i < tal_count(htlc_map); i++) {
|
||||
const struct htlc *htlc = htlc_map[i];
|
||||
|
||||
@@ -232,10 +240,11 @@ static void report_htlcs(const struct bitcoin_tx *tx,
|
||||
|
||||
if (htlc_owner(htlc) == LOCAL) {
|
||||
htlc_tx[i] = htlc_timeout_tx(htlc_tx, &txid, i,
|
||||
htlc, to_self_delay,
|
||||
remote_revocation_key,
|
||||
local_delayedkey,
|
||||
feerate_per_kw);
|
||||
htlc->msatoshi,
|
||||
htlc->expiry.locktime,
|
||||
to_self_delay,
|
||||
feerate_per_kw,
|
||||
&keyset);
|
||||
wscript[i] = bitcoin_wscript_htlc_offer(tmpctx,
|
||||
localkey,
|
||||
remotekey,
|
||||
@@ -243,10 +252,10 @@ static void report_htlcs(const struct bitcoin_tx *tx,
|
||||
remote_revocation_key);
|
||||
} else {
|
||||
htlc_tx[i] = htlc_success_tx(htlc_tx, &txid, i,
|
||||
htlc, to_self_delay,
|
||||
remote_revocation_key,
|
||||
local_delayedkey,
|
||||
feerate_per_kw);
|
||||
htlc->msatoshi,
|
||||
to_self_delay,
|
||||
feerate_per_kw,
|
||||
&keyset);
|
||||
wscript[i] = bitcoin_wscript_htlc_receive(tmpctx,
|
||||
&htlc->expiry,
|
||||
localkey,
|
||||
|
||||
Reference in New Issue
Block a user