bitcoin/signature: BIP143 signature support.

We hand in the witness_script: if non-NULL, we use BIP143-style
signature hash creation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-04-12 13:05:51 +09:30
parent 8545db418b
commit df5d4e3c10
6 changed files with 125 additions and 7 deletions

View File

@@ -487,6 +487,7 @@ static Pkt *check_and_save_commit_sig(struct peer *peer,
ci->tx, 0,
peer->anchor.redeemscript,
tal_count(peer->anchor.redeemscript),
NULL,
&peer->them.commitkey,
ci->sig))
return pkt_err(peer, "Bad signature");
@@ -806,6 +807,7 @@ Pkt *accept_pkt_close_sig(struct peer *peer, const Pkt *pkt, bool *acked,
if (!check_tx_sig(peer->dstate->secpctx, close_tx, 0,
peer->anchor.redeemscript,
tal_count(peer->anchor.redeemscript),
NULL,
&peer->them.commitkey, &theirsig))
return pkt_err(peer, "Invalid signature");