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

Function new_unsaved_channel

lightningd/channel.c:194–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194struct channel *new_unsaved_channel(struct peer *peer,
195 u32 feerate_base,
196 u32 feerate_ppm)
197{
198 struct lightningd *ld = peer->ld;
199 struct channel *channel = tal(ld, struct channel);
200 u8 *msg;
201
202 channel->peer = peer;
203 /* Not saved to the database yet! */
204 channel->unsaved_dbid = wallet_get_channel_dbid(ld->wallet);
205 /* A zero value database id means it's not saved in the database yet */
206 channel->dbid = 0;
207 channel->error = NULL;
208 channel->openchannel_signed_cmd = NULL;
209 channel->state = DUALOPEND_OPEN_INIT;
210 channel->owner = NULL;
211 channel->scb = NULL;
212 memset(&channel->billboard, 0, sizeof(channel->billboard));
213 channel->billboard.transient = tal_fmt(channel, "%s",
214 "Empty channel init'd");
215 channel->log = new_log(channel, ld->log_book,
216 &peer->id,
217 "chan#%"PRIu64,
218 channel->unsaved_dbid);
219
220 channel->our_config.id = 0;
221 channel->open_attempt = NULL;
222
223 channel->last_htlc_sigs = NULL;
224 channel->remote_channel_ready = false;
225 channel->scid = NULL;
226 channel->next_index[LOCAL] = 1;
227 channel->next_index[REMOTE] = 1;
228 channel->next_htlc_id = 0;
229 /* FIXME: remove push when v1 deprecated */
230 channel->push = AMOUNT_MSAT(0);
231 channel->closing_fee_negotiation_step = 50;
232 channel->closing_fee_negotiation_step_unit
233 = CLOSING_FEE_NEGOTIATION_STEP_UNIT_PERCENTAGE;
234 channel->shutdown_wrong_funding = NULL;
235 channel->closing_feerate_range = NULL;
236 channel->channel_update = NULL;
237 channel->alias[LOCAL] = channel->alias[REMOTE] = NULL;
238
239 channel->shutdown_scriptpubkey[REMOTE] = NULL;
240 channel->last_was_revoke = false;
241 channel->last_sent_commit = NULL;
242 channel->last_tx_type = TX_UNKNOWN;
243
244 channel->feerate_base = feerate_base;
245 channel->feerate_ppm = feerate_ppm;
246 channel->old_feerate_timeout.ts.tv_sec = 0;
247 channel->old_feerate_timeout.ts.tv_nsec = 0;
248 /* closer not yet known */
249 channel->closer = NUM_SIDES;
250
251 /* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9

Callers 3

json_openchannel_initFunction · 0.70
json_queryratesFunction · 0.70
peer_spokeFunction · 0.70

Calls 12

wallet_get_channel_dbidFunction · 0.85
shachain_initFunction · 0.85
towire_hsmd_new_channelFunction · 0.85
tal_hexFunction · 0.85
list_head_initFunction · 0.85
new_logFunction · 0.70
fatalFunction · 0.70
get_channel_basepointsFunction · 0.70
wire_sync_writeFunction · 0.50
wire_sync_readFunction · 0.50

Tested by

no test coverage detected