| 518 | }; |
| 519 | |
| 520 | static 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. */ |
no test coverage detected