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

Function handle_tx_broadcast

lightningd/dual_open_control.c:1437–1465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1435};
1436
1437static void handle_tx_broadcast(struct channel_send *cs)
1438{
1439 struct lightningd *ld = cs->channel->peer->ld;
1440 const struct wally_tx *wtx = cs->wtx;
1441 struct channel *channel = cs->channel;
1442 struct command *cmd = channel->openchannel_signed_cmd;
1443 struct json_stream *response;
1444 struct bitcoin_txid txid;
1445 struct amount_sat unused;
1446 int num_utxos;
1447
1448 /* This might have spent UTXOs from our wallet */
1449 num_utxos = wallet_extract_owned_outputs(ld->wallet,
1450 wtx, NULL,
1451 &unused);
1452 if (num_utxos)
1453 wallet_transaction_add(ld->wallet, wtx, 0, 0);
1454
1455 if (cmd) {
1456 response = json_stream_success(cmd);
1457 wally_txid(wtx, &txid);
1458 json_add_hex_talarr(response, "tx", linearize_wtx(tmpctx, wtx));
1459 json_add_txid(response, "txid", &txid);
1460 json_add_channel_id(response, "channel_id", &channel->cid);
1461 was_pending(command_success(cmd, response));
1462
1463 cs->channel->openchannel_signed_cmd = NULL;
1464 }
1465}
1466
1467static void check_utxo_block(struct bitcoind *bitcoind UNUSED,
1468 const struct bitcoin_tx_output *txout,

Callers 2

check_utxo_blockFunction · 0.85
sendfunding_doneFunction · 0.85

Calls 10

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

Tested by

no test coverage detected