lnwallet+contractcourt: remove redundant ChanPoint field

This commit is contained in:
Keagan McClelland committed 2024-03-07 14:16:16 -08:00
1 parent 5ccb9db78f
commit e9b3808c29
3 files changed
+11 -15

No files matched your search

+10 -10
View File
@@ -1010,7 +1010,7 @@ func initBreachedState(t *testing.T) (*BreachArbitrator,
func TestBreachHandoffSuccess(t *testing.T) {
brar, alice, _, bobClose, contractBreaches := initBreachedState(t)
chanPoint := alice.ChanPoint
chanPoint := alice.ChannelPoint()
// Signal a spend of the funding transaction and wait for the close
// observer to exit.
@@ -1096,7 +1096,7 @@ func TestBreachHandoffFail(t *testing.T) {
// Signal the notifier to dispatch spend notifications of the funding
// transaction using the transaction from bob's closing summary.
chanPoint := alice.ChanPoint
chanPoint := alice.ChannelPoint()
processACK := make(chan error)
breach := &ContractBreachEvent{
ChanPoint: *chanPoint,
@@ -1560,7 +1560,7 @@ func testBreachSpends(t *testing.T, test breachTest) {
var (
height = bobClose.ChanSnapshot.CommitHeight
forceCloseTx = bobClose.CloseTx
chanPoint = alice.ChanPoint
chanPoint = alice.ChannelPoint()
publTx = make(chan *wire.MsgTx)
publErr error
publMtx sync.Mutex
@@ -1764,7 +1764,7 @@ func testBreachSpends(t *testing.T, test breachTest) {
}
// Assert that the channel is fully resolved.
assertBrarCleanup(t, brar, alice.ChanPoint, alice.State().Db)
assertBrarCleanup(t, brar, alice.ChannelPoint(), alice.State().Db)
}
// TestBreachDelayedJusticeConfirmation tests that the breach arbiter will
@@ -1777,7 +1777,7 @@ func TestBreachDelayedJusticeConfirmation(t *testing.T) {
height = bobClose.ChanSnapshot.CommitHeight
blockHeight = int32(10)
forceCloseTx = bobClose.CloseTx
chanPoint = alice.ChanPoint
chanPoint = alice.ChannelPoint()
publTx = make(chan *wire.MsgTx)
)
@@ -1965,7 +1965,7 @@ func TestBreachDelayedJusticeConfirmation(t *testing.T) {
}
// Assert that the channel is fully resolved.
assertBrarCleanup(t, brar, alice.ChanPoint, alice.State().Db)
assertBrarCleanup(t, brar, alice.ChannelPoint(), alice.State().Db)
}
// findInputIndex returns the index of the input that spends from the given
@@ -2081,12 +2081,12 @@ func assertPendingClosed(t *testing.T, c *lnwallet.LightningChannel) {
require.NoError(t, err, "unable to load pending closed channels")
for _, chanSummary := range closedChans {
if chanSummary.ChanPoint == *c.ChanPoint {
if chanSummary.ChanPoint == *c.ChannelPoint() {
return
}
}
t.Fatalf("channel %v was not marked pending closed", c.ChanPoint)
t.Fatalf("channel %v was not marked pending closed", c.ChannelPoint())
}
// assertNotPendingClosed checks that the channel has not been marked pending
@@ -2098,9 +2098,9 @@ func assertNotPendingClosed(t *testing.T, c *lnwallet.LightningChannel) {
require.NoError(t, err, "unable to load pending closed channels")
for _, chanSummary := range closedChans {
if chanSummary.ChanPoint == *c.ChanPoint {
if chanSummary.ChanPoint == *c.ChannelPoint() {
t.Fatalf("channel %v was marked pending closed",
c.ChanPoint)
c.ChannelPoint())
}
}
}
-4
View File
@@ -1260,9 +1260,6 @@ type LightningChannel struct {
isClosed bool
// ChanPoint is the funding outpoint of this channel.
ChanPoint *wire.OutPoint
// sigPool is a pool of workers that are capable of signing and
// validating signatures in parallel. This is utilized as an
// optimization to void serially signing or validating the HTLC
@@ -1412,7 +1409,6 @@ func NewLightningChannel(signer input.Signer,
commitBuilder: NewCommitmentBuilder(state),
localUpdateLog: localUpdateLog,
remoteUpdateLog: remoteUpdateLog,
ChanPoint: &state.FundingOutpoint,
Capacity: state.Capacity,
taprootNonceProducer: taprootNonceProducer,
log: build.NewPrefixLog(logPrefix, walletLog),
+1 -1
View File
@@ -269,7 +269,7 @@ func addTestHtlcs(t *testing.T, remote, local *LightningChannel,
hash160map[hash160] = preimage
// Add htlc to the channel.
chanID := lnwire.NewChanIDFromOutPoint(remote.ChanPoint)
chanID := lnwire.NewChanIDFromOutPoint(remote.ChannelPoint())
msg := &lnwire.UpdateAddHTLC{
Amount: htlc.amount,