mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-26 12:00:19 +02:00
discovery+lnd: create new chanSeries impl of the ChannelGraphTimeSeries interface
In this commit, we create a new concrete implementation for the new discovery.ChannelGraphTimeSeries interface. We also export the createChannelAnnouncement method to allow the chanSeries struct to re-use the existing code for creating wire messages from the database structs.
This commit is contained in:
@@ -286,7 +286,7 @@ func (d *AuthenticatedGossiper) SynchronizeNode(pub *btcec.PublicKey) error {
|
||||
// also has known validated nodes, then we'll send that as
|
||||
// well.
|
||||
if chanInfo.AuthProof != nil {
|
||||
chanAnn, e1Ann, e2Ann, err := createChanAnnouncement(
|
||||
chanAnn, e1Ann, e2Ann, err := CreateChanAnnouncement(
|
||||
chanInfo.AuthProof, chanInfo, e1, e2,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -425,6 +425,9 @@ func (d *AuthenticatedGossiper) Stop() {
|
||||
d.wg.Wait()
|
||||
}
|
||||
|
||||
// TODO(roasbeef): need method to get current gossip timestamp?
|
||||
// * using mtx, check time rotate forward is needed?
|
||||
|
||||
// ProcessRemoteAnnouncement sends a new remote announcement message along with
|
||||
// the peer that sent the routing message. The announcement will be processed
|
||||
// then added to a queue for batched trickled announcement to all connected
|
||||
@@ -1432,7 +1435,7 @@ func (d *AuthenticatedGossiper) processRejectedEdge(chanAnnMsg *lnwire.ChannelAn
|
||||
|
||||
// We'll then create then validate the new fully assembled
|
||||
// announcement.
|
||||
chanAnn, e1Ann, e2Ann, err := createChanAnnouncement(
|
||||
chanAnn, e1Ann, e2Ann, err := CreateChanAnnouncement(
|
||||
proof, chanInfo, e1, e2,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -2088,7 +2091,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(nMsg *networkMsg) []n
|
||||
msg.ChannelID,
|
||||
peerID)
|
||||
|
||||
chanAnn, _, _, err := createChanAnnouncement(
|
||||
chanAnn, _, _, err := CreateChanAnnouncement(
|
||||
chanInfo.AuthProof, chanInfo, e1, e2,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -2163,7 +2166,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(nMsg *networkMsg) []n
|
||||
dbProof.BitcoinSig1Bytes = oppositeProof.BitcoinSignature.ToSignatureBytes()
|
||||
dbProof.BitcoinSig2Bytes = msg.BitcoinSignature.ToSignatureBytes()
|
||||
}
|
||||
chanAnn, e1Ann, e2Ann, err := createChanAnnouncement(&dbProof, chanInfo, e1, e2)
|
||||
chanAnn, e1Ann, e2Ann, err := CreateChanAnnouncement(&dbProof, chanInfo, e1, e2)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
nMsg.err <- err
|
||||
|
@@ -8,12 +8,12 @@ import (
|
||||
"github.com/roasbeef/btcd/btcec"
|
||||
)
|
||||
|
||||
// createChanAnnouncement is a helper function which creates all channel
|
||||
// CreateChanAnnouncement is a helper function which creates all channel
|
||||
// announcements given the necessary channel related database items. This
|
||||
// function is used to transform out database structs into the corresponding wire
|
||||
// structs for announcing new channels to other peers, or simply syncing up a
|
||||
// peer's initial routing table upon connect.
|
||||
func createChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
|
||||
func CreateChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
|
||||
chanInfo *channeldb.ChannelEdgeInfo,
|
||||
e1, e2 *channeldb.ChannelEdgePolicy) (*lnwire.ChannelAnnouncement,
|
||||
*lnwire.ChannelUpdate, *lnwire.ChannelUpdate, error) {
|
||||
|
Reference in New Issue
Block a user