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

Function stub_chan

lightningd/opening_control.c:1294–1444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1292}
1293
1294static struct channel *stub_chan(struct command *cmd,
1295 u64 id,
1296 struct node_id nodeid,
1297 struct channel_id cid,
1298 struct bitcoin_outpoint funding,
1299 struct wireaddr_internal addr,
1300 struct amount_sat funding_sats,
1301 struct channel_type *type)
1302{
1303 struct basepoints basepoints;
1304 struct bitcoin_signature *sig;
1305 struct channel *channel;
1306 struct channel_config *our_config;
1307 struct channel_config *their_config;
1308 struct channel_info *channel_info;
1309 struct lightningd *ld;
1310 struct peer *peer;
1311 struct pubkey localFundingPubkey;
1312 struct pubkey pk;
1313 struct short_channel_id *scid;
1314 u32 blockht;
1315 u32 feerate;
1316 u8 *dummy_sig = tal_hexdata(cmd,
1317 "30450221009b2e0eef267b94c3899fb0dc73750"
1318 "12e2cee4c10348a068fe78d1b82b4b1403602207"
1319 "7c3fad3adac2ddf33f415e45f0daf6658b7a0b09"
1320 "647de4443938ae2dbafe2b9" "01",
1321 144);
1322
1323 /* If the channel is already stored, return NULL. */
1324 peer = peer_by_id(cmd->ld, &nodeid);
1325 if (peer) {
1326 if (find_channel_by_id(peer, &cid)) {
1327 log_debug(cmd->ld->log, "channel %s already exists!",
1328 type_to_string(tmpctx, struct channel_id, &cid));
1329 return NULL;
1330 }
1331 } else {
1332 peer = new_peer(cmd->ld,
1333 0,
1334 &nodeid,
1335 &addr,
1336 false);
1337 }
1338
1339 ld = cmd->ld;
1340 feerate = FEERATE_FLOOR;
1341
1342 sig = tal(cmd, struct bitcoin_signature);
1343 signature_from_der(dummy_sig,
1344 tal_bytelen(dummy_sig)
1345 ,sig);
1346
1347 if (!pubkey_from_der(tal_hexdata(cmd,
1348 type_to_string(tmpctx,
1349 struct node_id,
1350 &nodeid),
1351 66),

Callers 1

json_recoverchannelFunction · 0.85

Calls 15

tal_hexdataFunction · 0.85
peer_by_idFunction · 0.85
signature_from_derFunction · 0.85
tal_bytelenFunction · 0.85
pubkey_from_derFunction · 0.85
mk_short_channel_idFunction · 0.85
new_fee_statesFunction · 0.85
get_network_blockheightFunction · 0.85
find_channel_by_idFunction · 0.70
new_peerFunction · 0.70
fatalFunction · 0.70
get_channel_basepointsFunction · 0.70

Tested by

no test coverage detected