MCPcopy Create free account
hub / github.com/ElementsProject/lightning / handle_get_output_scriptpubkey

Function handle_get_output_scriptpubkey

hsmd/libhsmd.c:816–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814}
815
816static u8 *handle_get_output_scriptpubkey(struct hsmd_client *c,
817 const u8 *msg_in)
818{
819 struct pubkey pubkey;
820 struct privkey privkey;
821 struct unilateral_close_info info;
822 u8 *scriptPubkey;
823
824 info.commitment_point = NULL;
825 if (!fromwire_hsmd_get_output_scriptpubkey(tmpctx, msg_in,
826 &info.channel_id,
827 &info.peer_id,
828 &info.commitment_point))
829 return hsmd_status_malformed_request(c, msg_in);
830
831 hsm_unilateral_close_privkey(&privkey, &info);
832 pubkey_from_privkey(&privkey, &pubkey);
833 scriptPubkey = scriptpubkey_p2wpkh(tmpctx, &pubkey);
834
835 return towire_hsmd_get_output_scriptpubkey_reply(NULL,
836 scriptPubkey);
837}
838
839/*~ The specific routine to sign the channel_announcement message. This is
840 * defined in BOLT #7, and requires *two* signatures: one from this node's key

Callers 1

Calls 4

pubkey_from_privkeyFunction · 0.85
scriptpubkey_p2wpkhFunction · 0.85

Tested by

no test coverage detected