secrets: peer_sign_theircommit() helper.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-01-22 06:44:26 +10:30
parent 90e381f750
commit 871e4d5172
2 changed files with 14 additions and 0 deletions

View File

@ -41,6 +41,18 @@ struct peer_secrets {
struct sha256 revocation_seed;
};
void peer_sign_theircommit(const struct peer *peer, struct signature *sig)
{
/* Commit tx only has one input: that of the anchor. */
sign_tx_input(peer->dstate->secpctx,
peer->them.commit, 0,
peer->anchor.redeemscript,
tal_count(peer->anchor.redeemscript),
&peer->secrets->commit,
&peer->us.commitkey,
sig);
}
static void new_keypair(struct lightningd_state *dstate,
struct privkey *privkey, struct pubkey *pubkey)
{

View File

@ -12,6 +12,8 @@ struct sha256;
void privkey_sign(struct peer *peer, const void *src, size_t len,
struct signature *sig);
void peer_sign_theircommit(const struct peer *peer, struct signature *sig);
void peer_secrets_init(struct peer *peer);
void peer_get_revocation_hash(const struct peer *peer, u64 index,