feat(node-info): expose MixPubKey as node info item (#3893)

Adds NodeInfoId.MyMixPubKey, returning the node's mix public key as
0x-prefixed hex via the existing debug API. Returns an empty string
when the mix protocol is not mounted.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Igor Sirotin 2026-05-20 21:53:08 +01:00 committed by GitHub
parent 42e0aa43d1
commit e7142110a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@
## accessible through the debug API. ## accessible through the debug API.
import std/[tables, sequtils, strutils] import std/[tables, sequtils, strutils]
import metrics, eth/p2p/discoveryv5/enr, libp2p/peerid import metrics, eth/p2p/discoveryv5/enr, libp2p/peerid, stew/byteutils
import waku/[waku_node, net/bound_ports] import waku/[waku_node, net/bound_ports]
type type
@ -16,6 +16,7 @@ type
MyENR MyENR
MyPeerId MyPeerId
MyBoundPorts MyBoundPorts
MyMixPubKey
WakuStateInfo* {.requiresInit.} = object WakuStateInfo* {.requiresInit.} = object
node: WakuNode node: WakuNode
@ -46,6 +47,11 @@ proc getNodeInfoItem*(self: WakuStateInfo, infoItemId: NodeInfoId): string =
return $PeerId(self.node.peerId()) return $PeerId(self.node.peerId())
of NodeInfoId.MyBoundPorts: of NodeInfoId.MyBoundPorts:
return $self.node.ports return $self.node.ports
of NodeInfoId.MyMixPubKey:
## Empty when the mix protocol is not mounted on this node.
if self.node.wakuMix.isNil():
return ""
return self.node.wakuMix.pubKey.to0xHex()
else: else:
return "unknown info item id" return "unknown info item id"