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

Function rbf_channel_hook_cb

lightningd/dual_open_control.c:481–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481static void rbf_channel_hook_cb(struct rbf_channel_payload *payload STEALS)
482{
483 struct subd *dualopend = payload->dualopend;
484 struct channel *channel = payload->channel;
485 u8 *msg;
486
487 tal_steal(tmpctx, payload);
488
489 if (!dualopend)
490 return;
491
492 tal_del_destructor2(dualopend, rbf_channel_remove_dualopend, payload);
493
494 if (channel->state != DUALOPEND_AWAITING_LOCKIN) {
495 log_debug(channel->log,
496 "rbf_channel hook returned, but channel in state"
497 " %s", channel_state_name(channel));
498 msg = towire_dualopend_fail(NULL, "Peer error. Channel"
499 " not ready for RBF attempt.");
500 return subd_send_msg(dualopend, take(msg));
501 }
502
503 if (payload->err_msg) {
504 log_debug(channel->log,
505 "rbf_channel hook rejects and says '%s'",
506 payload->err_msg);
507 msg = towire_dualopend_fail(NULL, payload->err_msg);
508 return subd_send_msg(dualopend, take(msg));
509 }
510
511 /* Update channel with new open attempt. */
512 channel->open_attempt = new_channel_open_attempt(channel);
513 msg = towire_dualopend_got_rbf_offer_reply(NULL,
514 payload->our_funding,
515 payload->psbt);
516 subd_send_msg(dualopend, take(msg));
517}
518
519
520

Callers 1

Calls 3

new_channel_open_attemptFunction · 0.85
channel_state_nameFunction · 0.70
subd_send_msgFunction · 0.70

Tested by

no test coverage detected