| 211 | } |
| 212 | |
| 213 | void 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 |
no test coverage detected