LIGHTNING-HOOK-RBF_CHANNEL(7)

πŸ“¦
version 26.06.9 Β· 2 versions
, in nixpkgs unstable

πŸ’… rbf_channel β€” a hook, bestie, from lightning-hook-rbf_channel(7)

okay so picture this: this whole page is about the rbf_channel hook, and it lives in section 7 of the manual. it's a plugin hook, it's giving main character energy, and it's literally the thing that handles RBF channel funding requests. stay with me, it's not that deep, I promise 🫢


✨ DESCRIPTION ✨

so the rbf_channel hook gets called when a peer proposes replacing the funding transaction of an existing channel using Replace-By-Fee (RBF). like, they wanna swap out the funding tx for a shinier one πŸ”₯

your plugin gets to be the one to decide: reject it, or let the negotiation continue. you're the vibe check here, no cap.

if you choose to continue, your plugin is allowed to contribute additional inputs and outputs by returning a PSBT and specifying an our_funding_msat amount. cute, right? you're literally adding to the pot πŸ’Έ

now the important bit, and do NOT skip this:

the our_funding_msat value must not be included in any output in the PSBT. like, ever. that's the rule.

change outputs should be included and calculated using the provided funding_feerate_per_kw. that's the number you do your math with, bestie, don't freelance it πŸŽ€


🌸 HOOK PAYLOAD 🌸

here's everything that gets handed to you, all wrapped up in one object:

  • rbf_channel (object):
    • id (pubkey) β€” the node_id of the peer proposing the RBF. so you know exactly who's asking πŸ‘€
    • channel_id (hash) β€” the channel_id of the channel being modified.
    • their_last_funding_msat (msat) β€” the peer's previous contribution to the funding transaction.
    • their_funding_msat (msat) β€” the peer's proposed new funding contribution.
    • our_last_funding_msat (msat) β€” our previous contribution to the funding transaction.
    • funding_feerate_per_kw (u32) β€” the feerate to use for the updated funding transaction, in satoshis per kw.
    • feerate_our_max (u32) β€” the maximum feerate we are willing to accept for the funding transaction.
    • feerate_our_min (u32) β€” the minimum feerate we are willing to accept for the funding transaction.
    • channel_max_msat (msat) β€” the maximum total channel capacity allowed for this channel.
    • locktime (u32) β€” the locktime to use for the funding transaction.
    • require_confirmed_inputs (boolean) β€” indicates whether the remote peer requires all inputs in the PSBT to be confirmed. if true, the plugin must avoid adding unconfirmed inputs. this one was added in v23.02, iconic ⭐
    • requested_lease_msat (msat, optional) β€” if present, the amount of liquidity the peer is requesting us to lease. this field is optional and only included if the peer requested a lease. so if it's not there, don't go looking for it πŸ™ˆ

πŸ’– HOOK RETURN πŸ’–

and here's what you send back:

  • result (string) (one of "continue", "reject") β€” whether to accept or reject the RBF proposal. pick your fighter.
  • psbt (string, optional) β€” a PSBT containing additional inputs and outputs to contribute to the funding transaction. only valid if result is continue. so don't be sneaky with it 🫢
  • our_funding_msat (msat, optional) β€” the amount we are contributing to the new funding transaction. must not be included in any output in the PSBT. (yes, again. it's that serious.)
  • error_message (string, optional) β€” an error message explaining the rejection. only used if result is reject, and it will be sent to the peer. so be nice, or at least be clear lmao πŸ“¨

πŸ¦‹ a lil sign-off πŸ¦‹

that's the whole page, bestie β€” no filler, no fluff, every field accounted for. this one ships with Core Lightning v26.06.9, and the page is dated to match. slay, go write a plugin, you've got this πŸ‘‘πŸ’œ

πŸ“¦ where this page comes from