| 1979 | } |
| 1980 | |
| 1981 | static void rbf_got_offer(struct subd *dualopend, const u8 *msg) |
| 1982 | { |
| 1983 | /* We expect the channel to still exist?! */ |
| 1984 | struct channel *channel; |
| 1985 | struct rbf_channel_payload *payload; |
| 1986 | |
| 1987 | channel = dualopend->channel; |
| 1988 | |
| 1989 | payload = tal(dualopend, struct rbf_channel_payload); |
| 1990 | payload->dualopend = dualopend; |
| 1991 | payload->channel = channel; |
| 1992 | |
| 1993 | if (!fromwire_dualopend_got_rbf_offer(payload, msg, |
| 1994 | &payload->channel_id, |
| 1995 | &payload->their_last_funding, |
| 1996 | &payload->their_proposed_funding, |
| 1997 | &payload->our_last_funding, |
| 1998 | &payload->funding_feerate_per_kw, |
| 1999 | &payload->locktime, |
| 2000 | &payload->requested_lease_amt, |
| 2001 | &payload->req_confirmed_ins_remote)) { |
| 2002 | channel_internal_error(channel, |
| 2003 | "Bad WIRE_DUALOPEND_GOT_RBF_OFFER: %s", |
| 2004 | tal_hex(msg, msg)); |
| 2005 | return; |
| 2006 | } |
| 2007 | |
| 2008 | /* There's currently another attempt in progress? */ |
| 2009 | if (channel->open_attempt) { |
| 2010 | log_debug(channel->log, |
| 2011 | "RBF attempted while previous attempt" |
| 2012 | " is still in progress"); |
| 2013 | |
| 2014 | subd_send_msg(dualopend, |
| 2015 | take(towire_dualopend_fail(NULL, |
| 2016 | "Error. Already negotiation" |
| 2017 | " in progress"))); |
| 2018 | return; |
| 2019 | } |
| 2020 | |
| 2021 | assert(channel_id_eq(&channel->cid, &payload->channel_id)); |
| 2022 | /* Fill in general channel info from channel */ |
| 2023 | payload->peer_id = channel->peer->id; |
| 2024 | payload->feerate_our_max = feerate_max(dualopend->ld, NULL); |
| 2025 | payload->feerate_our_min = feerate_min(dualopend->ld, NULL); |
| 2026 | |
| 2027 | payload->psbt = NULL; |
| 2028 | |
| 2029 | /* No error message known (yet) */ |
| 2030 | payload->err_msg = NULL; |
| 2031 | |
| 2032 | if (feature_negotiated(dualopend->ld->our_features, |
| 2033 | channel->peer->their_features, |
| 2034 | OPT_LARGE_CHANNELS)) |
| 2035 | payload->channel_max = chainparams->max_supply; |
| 2036 | else |
| 2037 | payload->channel_max = chainparams->max_funding; |
| 2038 |
no test coverage detected