discovery: move remotePubFromChanInfo to gossiper, remove utils

This commit is contained in:
Conner Fromknecht
2020-03-17 16:24:10 -07:00
parent 6a813e3433
commit 7b0d564692
2 changed files with 16 additions and 22 deletions

View File

@@ -1365,6 +1365,22 @@ func (d *AuthenticatedGossiper) processChanPolicyUpdate(
return chanUpdates, nil
}
// remotePubFromChanInfo returns the public key of the remote peer given a
// ChannelEdgeInfo that describe a channel we have with them.
func remotePubFromChanInfo(chanInfo *channeldb.ChannelEdgeInfo,
chanFlags lnwire.ChanUpdateChanFlags) [33]byte {
var remotePubKey [33]byte
switch {
case chanFlags&lnwire.ChanUpdateDirection == 0:
remotePubKey = chanInfo.NodeKey2Bytes
case chanFlags&lnwire.ChanUpdateDirection == 1:
remotePubKey = chanInfo.NodeKey1Bytes
}
return remotePubKey
}
// processRejectedEdge examines a rejected edge to see if we can extract any
// new announcements from it. An edge will get rejected if we already added
// the same edge without AuthProof to the graph. If the received announcement