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

Function validate_initial_commitment_signature

openingd/common.c:213–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void validate_initial_commitment_signature(int hsm_fd,
214 struct bitcoin_tx *tx,
215 struct bitcoin_signature *sig)
216{
217 struct existing_htlc **htlcs;
218 struct bitcoin_signature *htlc_sigs;
219 u32 feerate;
220 u64 commit_num;
221 const u8 *msg;
222 struct secret *old_secret;
223 struct pubkey next_point;
224
225 /* Validate the counterparty's signature. */
226 htlcs = tal_arr(NULL, struct existing_htlc *, 0);
227 htlc_sigs = tal_arr(NULL, struct bitcoin_signature, 0);
228 feerate = 0; /* unused since there are no htlcs */
229 commit_num = 0;
230 msg = towire_hsmd_validate_commitment_tx(NULL,
231 tx,
232 (const struct simple_htlc **) htlcs,
233 commit_num,
234 feerate,
235 sig,
236 htlc_sigs);
237 tal_free(htlc_sigs);
238 tal_free(htlcs);
239 wire_sync_write(hsm_fd, take(msg));
240 msg = wire_sync_read(tmpctx, hsm_fd);
241 if (!fromwire_hsmd_validate_commitment_tx_reply(tmpctx, msg, &old_secret, &next_point))
242 status_failed(STATUS_FAIL_HSM_IO,
243 "Reading validate_commitment_tx reply: %s",
244 tal_hex(tmpctx, msg));
245}
246

Callers 4

fundee_channelFunction · 0.85
accepter_commitsFunction · 0.85
opener_commitsFunction · 0.85

Calls 5

tal_freeFunction · 0.85
tal_hexFunction · 0.85
wire_sync_writeFunction · 0.50
wire_sync_readFunction · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected