MCPcopy Create free account
hub / github.com/ElementsProject/lightning / rbf_got_offer

Function rbf_got_offer

lightningd/dual_open_control.c:1803–1860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1801}
1802
1803static void rbf_got_offer(struct subd *dualopend, const u8 *msg)
1804{
1805 /* We expect the channel to still exist?! */
1806 struct channel *channel;
1807 struct rbf_channel_payload *payload;
1808
1809 channel = dualopend->channel;
1810
1811 payload = tal(dualopend, struct rbf_channel_payload);
1812 payload->dualopend = dualopend;
1813 payload->channel = channel;
1814
1815 if (!fromwire_dualopend_got_rbf_offer(msg,
1816 &payload->channel_id,
1817 &payload->their_funding,
1818 &payload->funding_feerate_per_kw,
1819 &payload->locktime)) {
1820 channel_internal_error(channel,
1821 "Bad WIRE_DUALOPEND_GOT_RBF_OFFER: %s",
1822 tal_hex(msg, msg));
1823 return;
1824 }
1825
1826 /* There's currently another attempt in progress? */
1827 if (channel->open_attempt) {
1828 log_debug(channel->log,
1829 "RBF attempted while previous attempt"
1830 " is still in progress");
1831
1832 subd_send_msg(dualopend,
1833 take(towire_dualopend_fail(NULL,
1834 "Error. Already negotiation"
1835 " in progress")));
1836 return;
1837 }
1838
1839 assert(channel_id_eq(&channel->cid, &payload->channel_id));
1840 /* Fill in general channel info from channel */
1841 payload->peer_id = channel->peer->id;
1842 payload->feerate_our_max = feerate_max(dualopend->ld, NULL);
1843 payload->feerate_our_min = feerate_min(dualopend->ld, NULL);
1844
1845 /* Set our contributions to empty, in case there is no plugin */
1846 payload->our_funding = AMOUNT_SAT(0);
1847 payload->psbt = NULL;
1848
1849 /* No error message known (yet) */
1850 payload->err_msg = NULL;
1851
1852 payload->channel_max = chainparams->max_funding;
1853 if (feature_negotiated(dualopend->ld->our_features,
1854 channel->peer->their_features,
1855 OPT_LARGE_CHANNELS))
1856 payload->channel_max = AMOUNT_SAT(UINT_MAX);
1857
1858 tal_add_destructor2(dualopend, rbf_channel_remove_dualopend, payload);
1859 plugin_hook_call_rbf_channel(dualopend->ld, NULL, payload);
1860}

Callers 1

dual_opend_msgFunction · 0.85

Calls 6

tal_hexFunction · 0.85
feerate_maxFunction · 0.85
feerate_minFunction · 0.85
channel_internal_errorFunction · 0.70
subd_send_msgFunction · 0.70
feature_negotiatedFunction · 0.50

Tested by

no test coverage detected