| 325 | } |
| 326 | |
| 327 | static void handle_onchain_broadcast_tx(struct channel *channel, |
| 328 | const u8 *msg) |
| 329 | { |
| 330 | struct bitcoin_tx *tx; |
| 331 | struct wallet *w = channel->peer->ld->wallet; |
| 332 | struct bitcoin_txid txid; |
| 333 | enum wallet_tx_type type; |
| 334 | bool is_rbf; |
| 335 | |
| 336 | if (!fromwire_onchaind_broadcast_tx(msg, msg, &tx, &type, &is_rbf)) { |
| 337 | channel_internal_error(channel, "Invalid onchain_broadcast_tx"); |
| 338 | return; |
| 339 | } |
| 340 | |
| 341 | tx->chainparams = chainparams; |
| 342 | |
| 343 | bitcoin_txid(tx, &txid); |
| 344 | wallet_transaction_add(w, tx->wtx, 0, 0); |
| 345 | wallet_transaction_annotate(w, &txid, type, channel->dbid); |
| 346 | |
| 347 | /* We don't really care if it fails, we'll respond via watch. */ |
| 348 | /* If the onchaind signals this as RBF-able, then we also |
| 349 | * set allowhighfees, as the transaction may be RBFed into |
| 350 | * high feerates as protection against the MAD-HTLC attack. */ |
| 351 | broadcast_tx(channel->peer->ld->topology, channel, |
| 352 | tx, NULL, is_rbf, |
| 353 | is_rbf ? &handle_onchain_broadcast_rbf_tx_cb : NULL); |
| 354 | } |
| 355 | |
| 356 | static void handle_onchain_unwatch_tx(struct channel *channel, const u8 *msg) |
| 357 | { |
no test coverage detected