script: make "sig_and_empty" more generic, make htlc tx witness fns clearer.

For non-delayed HTLC success spends, we have a similar pattern ("<sig>
<preimage> <wscript>") so a we want to use the same function.

The other routines don't say "witness" in them, and should.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-09-16 09:09:06 +09:30
parent 86ecc6a058
commit 6ef64cd52b
4 changed files with 43 additions and 40 deletions

View File

@@ -109,10 +109,10 @@ void htlc_success_tx_add_witness(struct bitcoin_tx *htlc_success,
&hash, revocationkey);
htlc_success->input[0].witness
= bitcoin_htlc_receive_spend_preimage(htlc_success->input,
localsig, remotesig,
payment_preimage,
wscript);
= bitcoin_witness_htlc_success_tx(htlc_success->input,
localsig, remotesig,
payment_preimage,
wscript);
tal_free(wscript);
}
@@ -150,9 +150,9 @@ void htlc_timeout_tx_add_witness(struct bitcoin_tx *htlc_timeout,
payment_hash, revocationkey);
htlc_timeout->input[0].witness
= bitcoin_htlc_offer_spend_timeout(htlc_timeout->input,
localsig, remotesig,
wscript);
= bitcoin_witness_htlc_timeout_tx(htlc_timeout->input,
localsig, remotesig,
wscript);
tal_free(wscript);
}