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 -1
View File
@@ -269,7 +269,7 @@ func NewChanCloser(cfg ChanCloseCfg, deliveryScript []byte,
closeReq *htlcswitch.ChanClose, locallyInitiated bool) *ChanCloser {
chanPoint := cfg.Channel.ChannelPoint()
cid := lnwire.NewChanIDFromOutPoint(&chanPoint)
cid := lnwire.NewChanIDFromOutPoint(chanPoint)
return &ChanCloser{
closeReq: closeReq,
state: closeIdle,
+7 -7
View File
@@ -3560,7 +3560,7 @@ func (lc *LightningChannel) createCommitDiff(
// used on the wire to identify this channel. We'll use this shortly
// when recording the exact CommitSig message that we'll be sending
// out.
chanID := lnwire.NewChanIDFromOutPoint(&lc.channelState.FundingOutpoint)
chanID := lnwire.NewChanIDFromOutPoint(lc.channelState.FundingOutpoint)
var (
logUpdates []channeldb.LogUpdate
@@ -3680,7 +3680,7 @@ func (lc *LightningChannel) createCommitDiff(
Commitment: *diskCommit,
CommitSig: &lnwire.CommitSig{
ChanID: lnwire.NewChanIDFromOutPoint(
&lc.channelState.FundingOutpoint,
lc.channelState.FundingOutpoint,
),
CommitSig: commitSig,
HtlcSigs: htlcSigs,
@@ -3698,7 +3698,7 @@ func (lc *LightningChannel) createCommitDiff(
func (lc *LightningChannel) getUnsignedAckedUpdates() []channeldb.LogUpdate {
// First, we need to convert the funding outpoint into the ID that's
// used on the wire to identify this channel.
chanID := lnwire.NewChanIDFromOutPoint(&lc.channelState.FundingOutpoint)
chanID := lnwire.NewChanIDFromOutPoint(lc.channelState.FundingOutpoint)
// Fetch the last remote update that we have signed for.
lastRemoteCommitted := lc.remoteCommitChain.tail().theirMessageIndex
@@ -4543,7 +4543,7 @@ func (lc *LightningChannel) ProcessChanSyncMsg(
case err == nil:
commitSig := &lnwire.CommitSig{
ChanID: lnwire.NewChanIDFromOutPoint(
&lc.channelState.FundingOutpoint,
lc.channelState.FundingOutpoint,
),
CommitSig: newCommit.CommitSig,
HtlcSigs: newCommit.HtlcSigs,
@@ -5571,7 +5571,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck,
len(unsignedAckedUpdates))
revocationMsg.ChanID = lnwire.NewChanIDFromOutPoint(
&lc.channelState.FundingOutpoint,
lc.channelState.FundingOutpoint,
)
return revocationMsg, newCommitment.Htlcs, finalHtlcs, nil
@@ -5638,7 +5638,7 @@ func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.RevokeAndAck) (
localChainTail := lc.localCommitChain.tail().height
source := lc.ShortChanID()
chanID := lnwire.NewChanIDFromOutPoint(&lc.channelState.FundingOutpoint)
chanID := lnwire.NewChanIDFromOutPoint(lc.channelState.FundingOutpoint)
// Determine the set of htlcs that can be forwarded as a result of
// having received the revocation. We will simultaneously construct the
@@ -8517,7 +8517,7 @@ func (lc *LightningChannel) generateRevocation(height uint64) (*lnwire.RevokeAnd
revocationMsg.NextRevocationKey = input.ComputeCommitmentPoint(nextCommitSecret[:])
revocationMsg.ChanID = lnwire.NewChanIDFromOutPoint(
&lc.channelState.FundingOutpoint,
lc.channelState.FundingOutpoint,
)
// If this is a taproot channel, then we also need to generate the
+3 -3
View File
@@ -3052,7 +3052,7 @@ func TestChanSyncOweCommitment(t *testing.T) {
}
chanID := lnwire.NewChanIDFromOutPoint(
&aliceChannel.channelState.FundingOutpoint,
aliceChannel.channelState.FundingOutpoint,
)
// With the HTLC's applied to both update logs, we'll initiate a state
@@ -3419,7 +3419,7 @@ func testChanSyncOweRevocation(t *testing.T, chanType channeldb.ChannelType) {
require.NoError(t, err, "unable to create test channels")
chanID := lnwire.NewChanIDFromOutPoint(
&aliceChannel.channelState.FundingOutpoint,
aliceChannel.channelState.FundingOutpoint,
)
// We'll start the test with Bob extending a single HTLC to Alice, and
@@ -4682,7 +4682,7 @@ func TestChanSyncUnableToSync(t *testing.T) {
// state.
badChanSync := &lnwire.ChannelReestablish{
ChanID: lnwire.NewChanIDFromOutPoint(
&aliceChannel.channelState.FundingOutpoint,
aliceChannel.channelState.FundingOutpoint,
),
NextLocalCommitHeight: 1000,
RemoteCommitTailHeight: 9000,
+1 -2
View File
@@ -269,8 +269,7 @@ func addTestHtlcs(t *testing.T, remote, local *LightningChannel,
hash160map[hash160] = preimage
// Add htlc to the channel.
chanPoint := remote.ChannelPoint()
chanID := lnwire.NewChanIDFromOutPoint(&chanPoint)
chanID := lnwire.NewChanIDFromOutPoint(remote.ChannelPoint())
msg := &lnwire.UpdateAddHTLC{
Amount: htlc.amount,