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

Function handle_tx_broadcast

lightningd/dual_open_control.c:1639–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1637};
1638
1639static void handle_tx_broadcast(struct channel_send *cs)
1640{
1641 struct lightningd *ld = cs->channel->peer->ld;
1642 const struct wally_tx *wtx = cs->wtx;
1643 struct channel *channel = cs->channel;
1644 struct command *cmd = channel->openchannel_signed_cmd;
1645 struct json_stream *response;
1646 struct bitcoin_txid txid;
1647
1648 /* This might have spent UTXOs from our wallet */
1649 if (wallet_extract_owned_outputs(ld->wallet,
1650 /* FIXME: what txindex? */
1651 wtx, false, NULL, NULL)) {
1652 wallet_transaction_add(ld->wallet, wtx, 0, 0);
1653 }
1654
1655 if (cmd) {
1656 response = json_stream_success(cmd);
1657 wally_txid(wtx, &txid);
1658 json_add_hex_talarr(response, "tx", linearize_wtx(tmpctx, wtx));
1659 json_add_txid(response, "txid", &txid);
1660 json_add_channel_id(response, "channel_id", &channel->cid);
1661 was_pending(command_success(cmd, response));
1662
1663 cs->channel->openchannel_signed_cmd = NULL;
1664 }
1665}
1666
1667static void check_utxo_block(struct bitcoind *bitcoind UNUSED,
1668 const struct bitcoin_tx_output *txout,

Callers 2

check_utxo_blockFunction · 0.70
sendfunding_doneFunction · 0.70

Calls 10

wally_txidFunction · 0.85
json_add_hex_talarrFunction · 0.85
linearize_wtxFunction · 0.85
json_add_txidFunction · 0.85
json_add_channel_idFunction · 0.85
json_stream_successFunction · 0.70
was_pendingFunction · 0.70
command_successFunction · 0.70
wallet_transaction_addFunction · 0.50

Tested by

no test coverage detected