| 123 | } |
| 124 | |
| 125 | struct channel_inflight * |
| 126 | new_inflight(struct channel *channel, |
| 127 | const struct bitcoin_outpoint *funding_outpoint, |
| 128 | u32 funding_feerate, |
| 129 | struct amount_sat total_funds, |
| 130 | struct amount_sat our_funds, |
| 131 | struct wally_psbt *psbt STEALS, |
| 132 | struct bitcoin_tx *last_tx, |
| 133 | const struct bitcoin_signature last_sig, |
| 134 | const u32 lease_expiry, |
| 135 | const secp256k1_ecdsa_signature *lease_commit_sig, |
| 136 | const u32 lease_chan_max_msat, const u16 lease_chan_max_ppt, |
| 137 | const u32 lease_blockheight_start, |
| 138 | const struct amount_msat lease_fee) |
| 139 | { |
| 140 | struct wally_psbt *last_tx_psbt_clone; |
| 141 | struct channel_inflight *inflight |
| 142 | = tal(channel, struct channel_inflight); |
| 143 | struct funding_info *funding |
| 144 | = tal(inflight, struct funding_info); |
| 145 | |
| 146 | funding->outpoint = *funding_outpoint; |
| 147 | funding->total_funds = total_funds; |
| 148 | funding->feerate = funding_feerate; |
| 149 | funding->our_funds = our_funds; |
| 150 | |
| 151 | inflight->funding = funding; |
| 152 | inflight->channel = channel; |
| 153 | inflight->remote_tx_sigs = false; |
| 154 | inflight->funding_psbt = tal_steal(inflight, psbt); |
| 155 | |
| 156 | /* Make a 'clone' of this tx */ |
| 157 | last_tx_psbt_clone = clone_psbt(inflight, last_tx->psbt); |
| 158 | inflight->last_tx = bitcoin_tx_with_psbt(inflight, last_tx_psbt_clone); |
| 159 | inflight->last_sig = last_sig; |
| 160 | inflight->tx_broadcast = false; |
| 161 | |
| 162 | /* Channel lease infos */ |
| 163 | inflight->lease_blockheight_start = lease_blockheight_start; |
| 164 | inflight->lease_expiry = lease_expiry; |
| 165 | inflight->lease_commit_sig |
| 166 | = tal_dup_or_null(inflight, secp256k1_ecdsa_signature, |
| 167 | lease_commit_sig); |
| 168 | |
| 169 | inflight->lease_chan_max_msat = lease_chan_max_msat; |
| 170 | inflight->lease_chan_max_ppt = lease_chan_max_ppt; |
| 171 | inflight->lease_fee = lease_fee; |
| 172 | |
| 173 | list_add_tail(&channel->inflights, &inflight->list); |
| 174 | tal_add_destructor(inflight, destroy_inflight); |
| 175 | |
| 176 | return inflight; |
| 177 | } |
| 178 | |
| 179 | struct open_attempt *new_channel_open_attempt(struct channel *channel) |
| 180 | { |