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:
Elle Mouton
2024-09-02 12:10:13 +02:00
parent 9be84c1bdc
commit a6bf76a0b7
3 changed files with 36 additions and 0 deletions

View File

@@ -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,