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

Function handle_tx_broadcast

lightningd/channel_control.c:520–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518};
519
520static void handle_tx_broadcast(struct send_splice_info *info)
521{
522 struct lightningd *ld = info->channel->peer->ld;
523 struct json_stream *response;
524 struct bitcoin_txid txid;
525 u8 *tx_bytes;
526 struct splice_command *cc;
527
528 tx_bytes = linearize_tx(tmpctx, info->final_tx);
529 bitcoin_txid(info->final_tx, &txid);
530
531 /* This might have spent UTXOs from our wallet */
532 if (wallet_extract_owned_outputs(ld->wallet,
533 info->final_tx->wtx, false,
534 NULL, NULL)) {
535 wallet_transaction_add(ld->wallet, info->final_tx->wtx, 0, 0);
536 }
537
538 cc = splice_command_for_chan(ld, info->channel);
539
540 if (cc) {
541 response = json_stream_success(cc->cmd);
542
543 json_add_hex(response, "tx", tx_bytes, tal_bytelen(tx_bytes));
544 json_add_txid(response, "txid", &txid);
545 json_add_u32(response, "outnum", info->output_index);
546 json_add_psbt(response, "psbt", info->psbt);
547
548 was_pending(command_success(cc->cmd, response));
549 }
550}
551
552/* Succeeds if the utxo was found in the mempool or in the utxo set. If it's in
553 * a block and spent it will fail but we're okay with that here. */

Callers 2

check_utxo_blockFunction · 0.70
send_splice_tx_doneFunction · 0.70

Calls 13

linearize_txFunction · 0.85
splice_command_for_chanFunction · 0.85
json_add_hexFunction · 0.85
tal_bytelenFunction · 0.85
json_add_txidFunction · 0.85
json_add_u32Function · 0.85
json_add_psbtFunction · 0.85
bitcoin_txidClass · 0.70
json_stream_successFunction · 0.70
was_pendingFunction · 0.70
command_successFunction · 0.70

Tested by

no test coverage detected