LIGHTNING-HOOK-PEER_CONNECTED(7)

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

πŸ’œ LIGHTNING-HOOK-PEER_CONNECTED(7) πŸ’œ

okay bestie, welcome to the LIGHTNING-HOOK-PEER_CONNECTED page β€” yes that whole mouthful is the manual name, section 7, we love a specific queen ✨

🌸 NAME 🌸

peer_connected β€” the hook that fires when a peer connects and finishes the handshake 🫢


✨ DESCRIPTION ✨

so the peer_connected hook gets called whenever a peer has connected and successfully completed the cryptographic handshake. like, not just knocked on the door β€” actually got all the way inside, handshake done, vibes verified πŸ’…

this is a chained hook, and that matters: the first plugin that returns "disconnect" stops further processing. one friend says goodbye and the whole group chat wraps up, no cap 😭

plugins are allowed to call listpeers to pull extra info about the peer β€” go ahead and gossip, bestie πŸ‘‘


πŸ¦‹ HOOK PAYLOAD πŸ¦‹

  • peer (object) β€” the whole main-character bundle, containing:
    • id (pubkey) β€” the node_id of the connected peer. their literal identity, iconic
    • direction (string) (one of "in", "out") β€” connection direction: in for incoming, out for outgoing. are they visiting us or are we visiting them πŸ’«
    • addr (string) β€” lowkey the most misunderstood field ngl: this shows the address that we are connected to ourselves, not the gossiped list of known addresses. and in particular this means that the port for incoming connections is an ephemeral port, that may not be available for reconnections 😭 so do not assume you can just dial it again later, it's gone like a limited-edition drop
    • features (hex) β€” feature bits advertised by the peer, encoded as hex. their whole personality, in hex πŸ”₯
    • remote_addr (string, optional) β€” our own address as reported by the remote peer. super helpful for detecting our own IPv4 changes behind NAT 🧚 (optional, so it might just not show up, don't come for me)

πŸ‘‘ HOOK RETURN πŸ‘‘

  • result (string) (one of "continue", "disconnect") β€” whether to allow the connection to proceed or disconnect the peer. the actual vibe check ⭐
  • error_message (string, optional) β€” optional error message sent to the peer before disconnection. only used if result is "disconnect", otherwise it's giving decorative πŸ™ˆ

🌈 SEE ALSO 🌈

  • lightning-listpeers(7) β€” go read it, it's literally the one place to get more tea about your peers πŸ“

friendly reminder bestie: chained hook means first "disconnect" wins and everything after it is cancelled. and that addr port? ephemeral. do not build your whole life plan on it πŸ’€

okay and finally, the little signature at the bottom of the original page: this is Core Lightning v26.06.9, filed under LIGHTNING-HOOK-PEER_CONNECTED(7) β€” that's the source and version, mwah, bye bestie πŸ’–πŸŽ€

πŸ“¦ where this page comes from