mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-03 17:26:57 +01:00
peer: notify routing manager of newly loaded channels
This commit is contained in:
parent
4113260f9f
commit
a4023144d3
1 changed files with 13 additions and 0 deletions
13
peer.go
13
peer.go
|
@ -228,6 +228,19 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
||||||
p.activeChannels[chanPoint] = lnChan
|
p.activeChannels[chanPoint] = lnChan
|
||||||
peerLog.Infof("peerID(%v) loaded ChannelPoint(%v)", p.id, chanPoint)
|
peerLog.Infof("peerID(%v) loaded ChannelPoint(%v)", p.id, chanPoint)
|
||||||
|
|
||||||
|
// Notify the routing table of this newly loaded channel.
|
||||||
|
chanInfo := lnChan.StateSnapshot()
|
||||||
|
capacity := int64(chanInfo.LocalBalance + chanInfo.RemoteBalance)
|
||||||
|
pubSerialized := p.addr.IdentityKey.SerializeCompressed()
|
||||||
|
vertex := hex.EncodeToString(pubSerialized)
|
||||||
|
p.server.routingMgr.OpenChannel(
|
||||||
|
graph.NewID(vertex),
|
||||||
|
graph.NewEdgeID(chanInfo.ChannelPoint.String()),
|
||||||
|
&rt.ChannelInfo{
|
||||||
|
Cpt: capacity,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// Register this new channel link with the HTLC Switch. This is
|
// Register this new channel link with the HTLC Switch. This is
|
||||||
// necessary to properly route multi-hop payments, and forward
|
// necessary to properly route multi-hop payments, and forward
|
||||||
// new payments triggered by RPC clients.
|
// new payments triggered by RPC clients.
|
||||||
|
|
Loading…
Add table
Reference in a new issue