multi: make NewChanIDFromOutpoint accept value instead of pointer

This commit is contained in:
Keagan McClelland committed 2024-03-08 15:47:55 -08:00
1 parent fd1cd315ce
commit db39a905cb
27 files changed
+108 -106

No files matched your search

+1 -2
View File
@@ -2602,8 +2602,7 @@ func (l *channelLink) UpdateShortChanID() (lnwire.ShortChannelID, error) {
//
// NOTE: Part of the ChannelLink interface.
func (l *channelLink) ChanID() lnwire.ChannelID {
chanPoint := l.channel.ChannelPoint()
return lnwire.NewChanIDFromOutPoint(&chanPoint)
return lnwire.NewChanIDFromOutPoint(l.channel.ChannelPoint())
}
// Bandwidth returns the total amount that can flow through the channel link at
+2 -2
View File
@@ -1497,7 +1497,7 @@ func TestChannelLinkMultiHopUnknownNextHop(t *testing.T) {
// back the payment to Alice since he is unaware of Carol when the
// payment comes across.
bobChanID := lnwire.NewChanIDFromOutPoint(
&channels.bobToCarol.State().FundingOutpoint,
channels.bobToCarol.ChannelPoint(),
)
n.bobServer.htlcSwitch.RemoveLink(bobChanID)
@@ -3763,7 +3763,7 @@ func TestChannelRetransmission(t *testing.T) {
}
chanPoint := channels.aliceToBob.ChannelPoint()
chanID := lnwire.NewChanIDFromOutPoint(&chanPoint)
chanID := lnwire.NewChanIDFromOutPoint(chanPoint)
serverErr := make(chan error, 4)
aliceInterceptor := createInterceptorFunc("[alice] <-- [bob]",
+2 -2
View File
@@ -621,7 +621,7 @@ func (s *Switch) UpdateForwardingPolicies(
// Update each link in chanPolicies.
for targetLink, policy := range chanPolicies {
cid := lnwire.NewChanIDFromOutPoint(&targetLink)
cid := lnwire.NewChanIDFromOutPoint(targetLink)
link, ok := s.linkIndex[cid]
if !ok {
@@ -1797,7 +1797,7 @@ out:
// relevant link (if it exists) so the channel can be
// cooperatively closed (if possible).
case req := <-s.chanCloseRequests:
chanID := lnwire.NewChanIDFromOutPoint(req.ChanPoint)
chanID := lnwire.NewChanIDFromOutPoint(*req.ChanPoint)
s.indexMtx.RLock()
link, ok := s.linkIndex[chanID]
+1 -1
View File
@@ -73,7 +73,7 @@ func genID() (lnwire.ChannelID, lnwire.ShortChannelID) {
hash1, _ := chainhash.NewHash(bytes.Repeat(scratch[:], 4))
chanPoint1 := wire.NewOutPoint(hash1, uint32(id))
chanID1 := lnwire.NewChanIDFromOutPoint(chanPoint1)
chanID1 := lnwire.NewChanIDFromOutPoint(*chanPoint1)
aliceChanID := lnwire.NewShortChanIDFromInt(id)
return chanID1, aliceChanID