Returns commitment_signed msg, sets @local_anchor */
| 1182 | |
| 1183 | /* Returns commitment_signed msg, sets @local_anchor */ |
| 1184 | static u8 *send_commit_part(const tal_t *ctx, |
| 1185 | struct peer *peer, |
| 1186 | const struct bitcoin_outpoint *funding, |
| 1187 | struct amount_sat funding_sats, |
| 1188 | const struct htlc **changed_htlcs, |
| 1189 | bool notify_master, |
| 1190 | s64 splice_amnt, |
| 1191 | s64 remote_splice_amnt, |
| 1192 | u64 remote_index, |
| 1193 | const struct pubkey *remote_per_commit, |
| 1194 | struct local_anchor_info **anchor, |
| 1195 | u16 batch_size, |
| 1196 | struct pubkey remote_funding_pubkey) |
| 1197 | { |
| 1198 | u8 *msg; |
| 1199 | struct bitcoin_signature commit_sig, *htlc_sigs; |
| 1200 | struct bitcoin_tx **txs; |
| 1201 | const u8 *funding_wscript; |
| 1202 | const struct htlc **htlc_map; |
| 1203 | struct wally_tx_output *direct_outputs[NUM_SIDES]; |
| 1204 | struct penalty_base *pbase; |
| 1205 | int local_anchor_outnum; |
| 1206 | struct pubkey funding_pubkeys[NUM_SIDES] = |
| 1207 | { peer->channel->funding_pubkey[LOCAL], |
| 1208 | remote_funding_pubkey }; |
| 1209 | struct tlv_commitment_signed_tlvs *cs_tlv |
| 1210 | = tlv_commitment_signed_tlvs_new(tmpctx); |
| 1211 | |
| 1212 | /* In theory, peer will ignore TLV 1 as unknown, but while |
| 1213 | * spec is in flux this is dangerous, as it may change: so don't |
| 1214 | * send unless negotiated */ |
| 1215 | if (feature_negotiated(peer->our_features, |
| 1216 | peer->their_features, |
| 1217 | OPT_SPLICE)) { |
| 1218 | status_debug("send_commit_part(splice: %d, remote_splice: %d," |
| 1219 | " index: %"PRIu64")", |
| 1220 | (int)splice_amnt, (int)remote_splice_amnt, |
| 1221 | remote_index); |
| 1222 | |
| 1223 | cs_tlv->splice_info = tal_dup(cs_tlv, struct bitcoin_txid, &funding->txid); |
| 1224 | } |
| 1225 | |
| 1226 | txs = channel_txs(tmpctx, funding, funding_sats, &htlc_map, |
| 1227 | direct_outputs, &funding_wscript, |
| 1228 | peer->channel, remote_per_commit, |
| 1229 | remote_index, REMOTE, |
| 1230 | splice_amnt, remote_splice_amnt, &local_anchor_outnum, |
| 1231 | funding_pubkeys); |
| 1232 | htlc_sigs = |
| 1233 | calc_commitsigs(tmpctx, peer, txs, funding_wscript, htlc_map, |
| 1234 | remote_index, remote_per_commit, &commit_sig, |
| 1235 | remote_funding_pubkey); |
| 1236 | |
| 1237 | if (direct_outputs[LOCAL] != NULL) { |
| 1238 | pbase = penalty_base_new(tmpctx, remote_index, |
| 1239 | txs[0], direct_outputs[LOCAL]); |
| 1240 | |
| 1241 | /* Add the penalty_base to our in-memory list as well, so we |
no test coverage detected