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

+2 -2
View File
@@ -1169,7 +1169,7 @@ func (c *OpenChannel) fullSync(tx kvdb.RwTx) error {
return ErrChanAlreadyExists
}
cid := lnwire.NewChanIDFromOutPoint(&c.FundingOutpoint)
cid := lnwire.NewChanIDFromOutPoint(c.FundingOutpoint)
if cidBucket.Get(cid[:]) != nil {
return ErrChanAlreadyExists
}
@@ -1574,7 +1574,7 @@ func (c *OpenChannel) ChanSyncMsg() (*lnwire.ChannelReestablish, error) {
return &lnwire.ChannelReestablish{
ChanID: lnwire.NewChanIDFromOutPoint(
&c.FundingOutpoint,
c.FundingOutpoint,
),
NextLocalCommitHeight: nextLocalCommitHeight,
RemoteCommitTailHeight: remoteChainTipHeight,
+1 -1
View File
@@ -704,7 +704,7 @@ func (c *ChannelStateDB) FetchChannelByID(tx kvdb.RTx, id lnwire.ChannelID) (
return err
}
chanID := lnwire.NewChanIDFromOutPoint(&outPoint)
chanID := lnwire.NewChanIDFromOutPoint(outPoint)
if chanID != id {
return nil
}
+4 -4
View File
@@ -140,7 +140,7 @@ func TestFetchClosedChannelForID(t *testing.T) {
state.FundingOutpoint.Index = i
// We calculate the ChannelID and use it to fetch the summary.
cid := lnwire.NewChanIDFromOutPoint(&state.FundingOutpoint)
cid := lnwire.NewChanIDFromOutPoint(state.FundingOutpoint)
fetchedSummary, err := cdb.FetchClosedChannelForID(cid)
if err != nil {
t.Fatalf("unable to fetch close summary: %v", err)
@@ -158,7 +158,7 @@ func TestFetchClosedChannelForID(t *testing.T) {
// As a final test we make sure that we get ErrClosedChannelNotFound
// for a ChannelID we didn't add to the DB.
state.FundingOutpoint.Index++
cid := lnwire.NewChanIDFromOutPoint(&state.FundingOutpoint)
cid := lnwire.NewChanIDFromOutPoint(state.FundingOutpoint)
_, err = cdb.FetchClosedChannelForID(cid)
if err != ErrClosedChannelNotFound {
t.Fatalf("expected ErrClosedChannelNotFound, instead got: %v", err)
@@ -240,7 +240,7 @@ func TestFetchChannel(t *testing.T) {
require.Equal(t, channelState, dbChannel)
// Next, attempt to fetch the channel by its channel ID.
chanID := lnwire.NewChanIDFromOutPoint(&channelState.FundingOutpoint)
chanID := lnwire.NewChanIDFromOutPoint(channelState.FundingOutpoint)
dbChannel, err = cdb.FetchChannelByID(nil, chanID)
require.NoError(t, err, "unable to fetch channel")
@@ -259,7 +259,7 @@ func TestFetchChannel(t *testing.T) {
_, err = cdb.FetchChannel(nil, channelState2.FundingOutpoint)
require.ErrorIs(t, err, ErrChannelNotFound)
chanID2 := lnwire.NewChanIDFromOutPoint(&channelState2.FundingOutpoint)
chanID2 := lnwire.NewChanIDFromOutPoint(channelState2.FundingOutpoint)
_, err = cdb.FetchChannelByID(nil, chanID2)
require.ErrorIs(t, err, ErrChannelNotFound)
}
+1 -1
View File
@@ -141,7 +141,7 @@ func checkPkgFilterEncodeDecode(t *testing.T, i uint16, f *channeldb.PkgFilter)
}
var (
chanID = lnwire.NewChanIDFromOutPoint(&wire.OutPoint{})
chanID = lnwire.NewChanIDFromOutPoint(wire.OutPoint{})
adds = []channeldb.LogUpdate{
{