Skip to content

Commit 06bf0c2

Browse files
committed
multi: let FetchPkScript take SCID by value
Instead of a pointer.
1 parent b77b698 commit 06bf0c2

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

discovery/gossiper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,7 +2033,7 @@ func (d *AuthenticatedGossiper) processRejectedEdge(_ context.Context,
20332033
}
20342034

20352035
// fetchPKScript fetches the output script for the given SCID.
2036-
func (d *AuthenticatedGossiper) fetchPKScript(chanID *lnwire.ShortChannelID) (
2036+
func (d *AuthenticatedGossiper) fetchPKScript(chanID lnwire.ShortChannelID) (
20372037
[]byte, error) {
20382038

20392039
return lnwallet.FetchPKScriptWithQuit(d.cfg.ChainIO, chanID, d.quit)
@@ -3737,7 +3737,7 @@ func (d *AuthenticatedGossiper) validateFundingTransaction(_ context.Context,
37373737
// Before we can add the channel to the channel graph, we need to obtain
37383738
// the full funding outpoint that's encoded within the channel ID.
37393739
fundingTx, err := lnwallet.FetchFundingTxWrapper(
3740-
d.cfg.ChainIO, &scid, d.quit,
3740+
d.cfg.ChainIO, scid, d.quit,
37413741
)
37423742
if err != nil {
37433743
//nolint:ll

lnwallet/interface.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ func SupportedWallets() []string {
760760

761761
// FetchFundingTxWrapper is a wrapper around FetchFundingTx, except that it will
762762
// exit when the supplied quit channel is closed.
763-
func FetchFundingTxWrapper(chain BlockChainIO, chanID *lnwire.ShortChannelID,
763+
func FetchFundingTxWrapper(chain BlockChainIO, chanID lnwire.ShortChannelID,
764764
quit chan struct{}) (*wire.MsgTx, error) {
765765

766766
txChan := make(chan *wire.MsgTx, 1)
@@ -795,7 +795,7 @@ func FetchFundingTxWrapper(chain BlockChainIO, chanID *lnwire.ShortChannelID,
795795
// TODO(roasbeef): replace with call to GetBlockTransaction? (would allow to
796796
// later use getblocktxn).
797797
func FetchFundingTx(chain BlockChainIO,
798-
chanID *lnwire.ShortChannelID) (*wire.MsgTx, error) {
798+
chanID lnwire.ShortChannelID) (*wire.MsgTx, error) {
799799

800800
// First fetch the block hash by the block number encoded, then use
801801
// that hash to fetch the block itself.
@@ -826,7 +826,7 @@ func FetchFundingTx(chain BlockChainIO,
826826
// FetchPKScriptWithQuit fetches the output script for the given SCID and exits
827827
// early with an error if the provided quit channel is closed before
828828
// completion.
829-
func FetchPKScriptWithQuit(chain BlockChainIO, chanID *lnwire.ShortChannelID,
829+
func FetchPKScriptWithQuit(chain BlockChainIO, chanID lnwire.ShortChannelID,
830830
quit chan struct{}) ([]byte, error) {
831831

832832
tx, err := FetchFundingTxWrapper(chain, chanID, quit)
@@ -835,7 +835,7 @@ func FetchPKScriptWithQuit(chain BlockChainIO, chanID *lnwire.ShortChannelID,
835835
}
836836

837837
outputLocator := chanvalidate.ShortChanIDChanLocator{
838-
ID: *chanID,
838+
ID: chanID,
839839
}
840840

841841
output, _, err := outputLocator.Locate(tx)

netann/channel_announcement.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func CreateChanAnnouncement(chanProof *models.ChannelAuthProof,
104104

105105
// FetchPkScript defines a function that can be used to fetch the output script
106106
// for the transaction with the given SCID.
107-
type FetchPkScript func(*lnwire.ShortChannelID) ([]byte, error)
107+
type FetchPkScript func(lnwire.ShortChannelID) ([]byte, error)
108108

109109
// ValidateChannelAnn validates the channel announcement.
110110
func ValidateChannelAnn(a lnwire.ChannelAnnouncement,
@@ -249,7 +249,7 @@ func validateChannelAnn2(a *lnwire.ChannelAnnouncement2,
249249
// If bitcoin keys are not provided, then we need to get the
250250
// on-chain output key since this will be the 3rd key in the
251251
// 3-of-3 MuSig2 signature.
252-
pkScript, err := fetchPkScript(&a.ShortChannelID.Val)
252+
pkScript, err := fetchPkScript(a.ShortChannelID.Val)
253253
if err != nil {
254254
return err
255255
}

netann/channel_announcement_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func test3of3MuSig2ChanAnnouncement(t *testing.T) {
223223
// We'll pass in a mock tx fetcher that will return the funding output
224224
// containing this key. This is needed since the output key can not be
225225
// determined from the channel announcement itself.
226-
fetchTx := func(chanID *lnwire.ShortChannelID) ([]byte, error) {
226+
fetchTx := func(_ lnwire.ShortChannelID) ([]byte, error) {
227227
return pkScript, nil
228228
}
229229

0 commit comments

Comments
 (0)