mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-09 21:56:47 +01:00
lnwallet: include peer pub key in aux chan state
In order to help external components to query the custom records of a channel we need to expose the remote peer pub key. We could look-up custom records based on the funding outpoint, but that relation is established when receiving the ChannelReady message. The external components may query the AuxChanState before that message is received, so let's make sure the peer pub key is also available.
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user