LIGHTNING-HOOK-OPENCHANNEL2_CHANGED(7)

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

🌸 NAME 🌸

openchannel2_changed β€” the hook for handling updates to the dual-funding PSBT. This is the LIGHTNING-HOOK-OPENCHANNEL2_CHANGED(7) manual page, bestie, and it is lowkey iconic. πŸ’…

✨ DESCRIPTION ✨

The openchannel2_changed hook gets called when the peer sends an updated PSBT during dual-funding channel negotiation. Periodt. It lets plugins inspect and modify the PSBT before it is sent back to the peer. Negotiation keeps going until neither side makes further changes to the PSBT β€” at that point, commitment transactions are exchanged. πŸ’–

See plugins/funder.c for an example of how to use this hook to continue a v2 channel open. No cap, it's right there in the source.

πŸŽ€ HOOK PAYLOAD πŸŽ€

  • openchannel2_changed (object): the payload object, main character energy only.
    • channel_id (hash): the temporary channel_id identifying the channel being negotiated.
    • psbt (string): the current Partially Signed Bitcoin Transaction (PSBT) representing the funding transaction. This PSBT includes contributions from both peers and may be modified. Slay, you can touch it.
    • 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. (added v23.02)
🚨 Vibe check: when require_confirmed_inputs is true, do not add unconfirmed inputs. The remote peer is requiring all inputs in the PSBT to be confirmed, so respect that, bestie.

πŸ¦‹ HOOK RETURN πŸ¦‹

  • result (string) (always "continue"): must be set to "continue" to proceed with the channel opening negotiation.
  • psbt (string): the updated PSBT to send back to the peer. If no modifications are made, this should be identical to the input PSBT.

🌈 EXAMPLES 🌈

⭐ Example 1

Request:

$ lightning-cli openchannel2_changed -k "openchannel2_changed"='{"channel_id": "252d1b0a1e57895e841...", "psbt": "cHNidP8BADMCAAAAAQ+yBipSVZr...", "require_confirmed_inputs": true}'
{
  "id": "example:openchannel2_changed#1",
  "method": "openchannel2_changed",
  "params": {
    "openchannel2_changed": {
      "channel_id": "252d1b0a1e57895e841...",
      "psbt": "cHNidP8BADMCAAAAAQ+yBipSVZr...",
      "require_confirmed_inputs": true
    }
  }
}

Response:

{
  "result": "continue",
  "psbt": "cHNidP8BADMCAAAAAQ+yBipSVZr..."
}

Final cute sign-off: this page comes from Core Lightning v26.06.9 and its manual name is LIGHTNING-HOOK-OPENCHANNEL2_CHANGED(7). The original footer doesn’t print a date, so I’m not inventing one β€” periodt, bye bestie! πŸ«ΆπŸ’–

πŸ“¦ where this page comes from