| 2214 | } |
| 2215 | |
| 2216 | static void rbf_got_offer(struct subd *dualopend, const u8 *msg) |
| 2217 | { |
| 2218 | /* We expect the channel to still exist?! */ |
| 2219 | struct channel *channel; |
| 2220 | struct rbf_channel_payload *payload; |
| 2221 | |
| 2222 | channel = dualopend->channel; |
| 2223 | |
| 2224 | payload = tal(dualopend, struct rbf_channel_payload); |
| 2225 | payload->dualopend = dualopend; |
| 2226 | payload->channel = channel; |
| 2227 | |
| 2228 | if (!fromwire_dualopend_got_rbf_offer(payload, msg, |
| 2229 | &payload->channel_id, |
| 2230 | &payload->their_last_funding, |
| 2231 | &payload->their_proposed_funding, |
| 2232 | &payload->our_last_funding, |
| 2233 | &payload->funding_feerate_per_kw, |
| 2234 | &payload->locktime, |
| 2235 | &payload->requested_lease_amt, |
| 2236 | &payload->req_confirmed_ins_remote)) { |
| 2237 | channel_internal_error(channel, |
| 2238 | "Bad WIRE_DUALOPEND_GOT_RBF_OFFER: %s", |
| 2239 | tal_hex(msg, msg)); |
| 2240 | return; |
| 2241 | } |
| 2242 | |
| 2243 | /* There's currently another attempt in progress? */ |
| 2244 | if (channel->open_attempt) { |
| 2245 | log_debug(channel->log, |
| 2246 | "RBF attempted while previous attempt" |
| 2247 | " is still in progress"); |
| 2248 | |
| 2249 | subd_send_msg(dualopend, |
| 2250 | take(towire_dualopend_fail(NULL, |
| 2251 | "Error. Already negotiation" |
| 2252 | " in progress"))); |
| 2253 | return; |
| 2254 | } |
| 2255 | |
| 2256 | /*~ Same as for our own openchannel_bump: once a candidate is confirmed |
| 2257 | * deeply enough that we've committed the channel to it, there is nothing |
| 2258 | * left to replace, and accepting an attempt would only strand the scid |
| 2259 | * on one tx and channel->funding on another. A reorg un-promotes and |
| 2260 | * clears the scid, which makes RBF available again. */ |
| 2261 | if (channel->scid) { |
| 2262 | log_debug(channel->log, |
| 2263 | "RBF attempted after funding tx %s confirmed", |
| 2264 | fmt_bitcoin_txid(tmpctx, &channel->funding.txid)); |
| 2265 | |
| 2266 | subd_send_msg(dualopend, |
| 2267 | take(towire_dualopend_fail(NULL, |
| 2268 | "Error. Funding transaction" |
| 2269 | " already confirmed"))); |
| 2270 | return; |
| 2271 | } |
| 2272 | |
| 2273 | assert(channel_id_eq(&channel->cid, &payload->channel_id)); |
no test coverage detected