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

Function handle_onchain_broadcast_tx

lightningd/onchain_control.c:327–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327static 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
356static void handle_onchain_unwatch_tx(struct channel *channel, const u8 *msg)
357{

Callers 1

onchain_msgFunction · 0.85

Calls 5

channel_internal_errorFunction · 0.70
bitcoin_txidClass · 0.70
broadcast_txFunction · 0.70
wallet_transaction_addFunction · 0.50

Tested by

no test coverage detected