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

Function stub_chan

lightningd/opening_control.c:1510–1689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1508}
1509
1510static struct channel *stub_chan(struct command *cmd,
1511 u64 id,
1512 struct node_id nodeid,
1513 struct channel_id cid,
1514 struct bitcoin_outpoint funding,
1515 struct wireaddr addr,
1516 struct amount_sat funding_sats,
1517 struct channel_type *type,
1518 struct shachain shachain,
1519 struct basepoints their_basepoint,
1520 enum side opener,
1521 u16 remote_to_self_delay)
1522{
1523 struct basepoints basepoints;
1524 struct bitcoin_signature *sig;
1525 struct channel *channel;
1526 struct channel_config *our_config;
1527 struct channel_config *their_config;
1528 struct channel_info *channel_info;
1529 struct lightningd *ld;
1530 struct peer *peer;
1531 struct pubkey localFundingPubkey;
1532 struct pubkey pk;
1533 struct short_channel_id scid;
1534 u32 blockht;
1535 u32 feerate;
1536 struct channel_stats zero_channel_stats;
1537 struct wallet_shachain *their_shachain = tal(cmd, struct wallet_shachain);
1538 their_shachain->chain = shachain;
1539 their_shachain->id = 0;
1540
1541 u8 *dummy_sig = tal_hexdata(cmd,
1542 "30450221009b2e0eef267b94c3899fb0dc73750"
1543 "12e2cee4c10348a068fe78d1b82b4b1403602207"
1544 "7c3fad3adac2ddf33f415e45f0daf6658b7a0b09"
1545 "647de4443938ae2dbafe2b9" "01",
1546 144);
1547
1548 /* If the channel is already stored, return NULL. */
1549 if (channel_exists_by_id(cmd->ld->wallet, id)) {
1550 log_debug(cmd->ld->log, "channel %s already exists!",
1551 fmt_channel_id(tmpctx, &cid));
1552 return NULL;
1553 }
1554
1555 peer = peer_by_id(cmd->ld, &nodeid);
1556 if (!peer) {
1557 struct wireaddr_internal wint;
1558
1559 wireaddr_internal_from_wireaddr(&wint, &addr);
1560 peer = new_peer(cmd->ld,
1561 0,
1562 &nodeid,
1563 &wint,
1564 &addr,
1565 NULL,
1566 false);
1567 }

Callers 1

json_recoverchannelFunction · 0.85

Calls 15

tal_hexdataFunction · 0.85
channel_exists_by_idFunction · 0.85
peer_by_idFunction · 0.85
signature_from_derFunction · 0.85
tal_bytelenFunction · 0.85
pubkey_from_derFunction · 0.85
fmt_node_idFunction · 0.85
mk_short_channel_idFunction · 0.85
new_fee_statesFunction · 0.85
new_height_statesFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected