bitcoin/script: update scripts to the lightningnetwork/lightning-rfc#123 version

aka "BOLT 3: Use revocation key hash rather than revocation key",
which builds on top of lightningnetwork/lightning-rfc#105 "BOLT 2,3,5:
Make htlc outputs of the commitment tx spendable with revocation key".

This affects callers, since they now need to hand us the revocation
pubkey, but commit_tx has that already anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-03-07 16:16:59 +10:30
parent de39752d05
commit 29d6004efc
7 changed files with 100 additions and 50 deletions

View File

@@ -227,7 +227,8 @@ static void report_htlcs(const struct bitcoin_tx *tx,
wscript[i] = bitcoin_wscript_htlc_offer(tmpctx,
localkey,
remotekey,
&htlc->rhash);
&htlc->rhash,
local_revocation_key);
} else {
htlc_tx[i] = htlc_success_tx(htlc_tx, &txid, i,
htlc, to_self_delay,
@@ -238,7 +239,8 @@ static void report_htlcs(const struct bitcoin_tx *tx,
&htlc->expiry,
localkey,
remotekey,
&htlc->rhash);
&htlc->rhash,
local_revocation_key);
}
sign_tx_input(htlc_tx[i], 0,
NULL,
@@ -271,13 +273,15 @@ static void report_htlcs(const struct bitcoin_tx *tx,
htlc_timeout_tx_add_witness(htlc_tx[i],
localkey, remotekey,
&htlc->rhash,
local_revocation_key,
&localsig, &remotesig[i]);
} else {
htlc_success_tx_add_witness(htlc_tx[i],
&htlc->expiry,
localkey, remotekey,
&localsig, &remotesig[i],
htlc->r);
htlc->r,
local_revocation_key);
}
printf("output htlc_%s_tx %"PRIu64": %s\n",
htlc_owner(htlc) == LOCAL ? "timeout" : "success",