lnwallet: include peer pub key in aux chan state
What changed, and why it matters
This commit adds the remote peer's public key to an internal data structure (AuxChanState) used by external components to look up custom channel records. Public keys are not secrets, and the change only exposes information that was already available elsewhere in the channel state. There is no indication this fixes a vulnerability or changes security behavior.
No security action required. Review as a normal API/data-availability change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch extends lnwallet.AuxChanState with a PeerPubKey field (route.Vertex) and populates it in NewAuxChanState from chanState.IdentityPub.SerializeCompressed(). The stated motivation is to let external components query custom records before the ChannelReady message establishes the funding-outpoint relation. This is an API/data exposure change, not a security fix.
Changed components
lnwallet/aux_leaf_store.goInspect captured patch +8 / −0
diff --git a/lnwallet/aux_leaf_store.go b/lnwallet/aux_leaf_store.go
index aa2cc3b..0a85050 100644
--- a/lnwallet/aux_leaf_store.go
+++ b/lnwallet/aux_leaf_store.go
@@ -9,6 +9,7 @@ import (
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire"
+ "github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/tlv"
)
@@ -97,6 +98,10 @@ type AuxChanState struct {
// funding output.
TapscriptRoot fn.Option[chainhash.Hash]
+ // PeerPubKey is the peer pub key of the peer we've established this
+ // channel with.
+ PeerPubKey route.Vertex
+
// CustomBlob is an optional blob that can be used to store information
// specific to a custom channel type. This information is only created
// at channel funding time, and after wards is to be considered
@@ -106,6 +111,8 @@ type AuxChanState struct {
// NewAuxChanState creates a new AuxChanState from the given channel state.
func NewAuxChanState(chanState *channeldb.OpenChannel) AuxChanState {
+ peerPub := chanState.IdentityPub.SerializeCompressed()
+
return AuxChanState{
ChanType: chanState.ChanType,
FundingOutpoint: chanState.FundingOutpoint,
@@ -116,6 +123,7 @@ func NewAuxChanState(chanState *channeldb.OpenChannel) AuxChanState {
RemoteChanCfg: chanState.RemoteChanCfg,
ThawHeight: chanState.ThawHeight,
TapscriptRoot: chanState.TapscriptRoot,
+ PeerPubKey: route.Vertex(peerPub),
CustomBlob: chanState.CustomBlob,
}
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.