From 9c07376dcfb0770d7322f4e084b42003136e3e12 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 3 Apr 2017 13:04:52 +0930 Subject: [PATCH] channeld: Use local secret to generate bitcoin signature This key will eventually migrate to the HSM, but for now it's in the channeld so we generate the signature there. --- lightningd/channel/channel.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lightningd/channel/channel.c b/lightningd/channel/channel.c index be2eaec91..a479387d2 100644 --- a/lightningd/channel/channel.c +++ b/lightningd/channel/channel.c @@ -145,9 +145,11 @@ static void send_announcement_signatures(struct peer *peer) "HSM returned an invalid signature"); } - /* FIXME: Calculate bitcoin sig. */ - memset(&peer->announcement_bitcoin_sigs[LOCAL], 0, - sizeof(peer->announcement_bitcoin_sigs[LOCAL])); + /* TODO(cdecker) Move this to the HSM once we store the + * funding_privkey there */ + sign_hash(&peer->our_secrets.funding_privkey, &hash, + &peer->announcement_bitcoin_sigs[LOCAL]); + msg = towire_announcement_signatures( tmpctx, &peer->channel_id, &peer->short_channel_ids[LOCAL], &peer->announcement_node_sigs[LOCAL],