LIGHTNING-HOOK-PEER_CONNECTED(7)
π 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) β thenode_idof the connected peer. their literal identity, iconicdirection(string) (one of"in","out") β connection direction:infor incoming,outfor 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 dropfeatures(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 ifresultis"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 thataddrport? 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
- nixpkgs unstable: clightning 26.06.9
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms