multi: don't leak underlying pointer to LightningChannel.ChannelPoint()

This commit is contained in:
Keagan McClelland committed 2024-03-08 15:27:19 -08:00
1 parent e9b3808c29
commit fd1cd315ce
11 files changed
+53 -42

No files matched your search

+3 -2
View File
@@ -268,11 +268,12 @@ func NewChanCloser(cfg ChanCloseCfg, deliveryScript []byte,
idealFeePerKw chainfee.SatPerKWeight, negotiationHeight uint32,
closeReq *htlcswitch.ChanClose, locallyInitiated bool) *ChanCloser {
cid := lnwire.NewChanIDFromOutPoint(cfg.Channel.ChannelPoint())
chanPoint := cfg.Channel.ChannelPoint()
cid := lnwire.NewChanIDFromOutPoint(&chanPoint)
return &ChanCloser{
closeReq: closeReq,
state: closeIdle,
chanPoint: *cfg.Channel.ChannelPoint(),
chanPoint: chanPoint,
cid: cid,
cfg: cfg,
negotiationHeight: negotiationHeight,
+2 -2
View File
@@ -146,8 +146,8 @@ type mockChannel struct {
remoteKey keychain.KeyDescriptor
}
func (m *mockChannel) ChannelPoint() *wire.OutPoint {
return &m.chanPoint
func (m *mockChannel) ChannelPoint() wire.OutPoint {
return m.chanPoint
}
func (m *mockChannel) MarkCoopBroadcasted(*wire.MsgTx, bool) error {
+1 -1
View File
@@ -29,7 +29,7 @@ type CoopFeeEstimator interface {
// closing process.
type Channel interface { //nolint:interfacebloat
// ChannelPoint returns the channel point of the target channel.
ChannelPoint() *wire.OutPoint
ChannelPoint() wire.OutPoint
// MarkCoopBroadcasted persistently marks that the channel close
// transaction has been broadcast.
+2 -2
View File
@@ -6426,8 +6426,8 @@ func (lc *LightningChannel) ReceiveFailHTLC(htlcIndex uint64, reason []byte,
// ChannelPoint returns the outpoint of the original funding transaction which
// created this active channel. This outpoint is used throughout various
// subsystems to uniquely identify an open channel.
func (lc *LightningChannel) ChannelPoint() *wire.OutPoint {
return &lc.channelState.FundingOutpoint
func (lc *LightningChannel) ChannelPoint() wire.OutPoint {
return lc.channelState.FundingOutpoint
}
// ShortChanID returns the short channel ID for the channel. The short channel
+2 -1
View File
@@ -269,7 +269,8 @@ func addTestHtlcs(t *testing.T, remote, local *LightningChannel,
hash160map[hash160] = preimage
// Add htlc to the channel.
chanID := lnwire.NewChanIDFromOutPoint(remote.ChannelPoint())
chanPoint := remote.ChannelPoint()
chanID := lnwire.NewChanIDFromOutPoint(&chanPoint)
msg := &lnwire.UpdateAddHTLC{
Amount: htlc.amount,