mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
discovery+lnwallet: add fetchPKScript helper to gossiper
This commit makes an lnwallet.BlockChainIO available to the gossiper and uses it to construct a helper that can be used to fetch the pk script for a given SCID. This will be used for channel announcement verification in an upcoming commit.
This commit is contained in:
@@ -171,6 +171,10 @@ type Config struct {
|
||||
// order to be included in the LN graph.
|
||||
Graph graph.ChannelGraphSource
|
||||
|
||||
// ChainIO represents an abstraction over a source that can query the
|
||||
// blockchain.
|
||||
ChainIO lnwallet.BlockChainIO
|
||||
|
||||
// ChanSeries is an interfaces that provides access to a time series
|
||||
// view of the current known channel graph. Each GossipSyncer enabled
|
||||
// peer will utilize this in order to create and respond to channel
|
||||
@@ -1930,6 +1934,13 @@ func (d *AuthenticatedGossiper) processRejectedEdge(
|
||||
return announcements, nil
|
||||
}
|
||||
|
||||
// fetchPKScript fetches the output script for the given SCID.
|
||||
func (d *AuthenticatedGossiper) fetchPKScript(chanID *lnwire.ShortChannelID) (
|
||||
[]byte, error) {
|
||||
|
||||
return lnwallet.FetchPKScriptWithQuit(d.cfg.ChainIO, chanID, d.quit)
|
||||
}
|
||||
|
||||
// addNode processes the given node announcement, and adds it to our channel
|
||||
// graph.
|
||||
func (d *AuthenticatedGossiper) addNode(msg *lnwire.NodeAnnouncement,
|
||||
|
||||
Reference in New Issue
Block a user