multi: refactor select methods within channeldb to use ChannelParty

Also in this commit is a small adjustment to the call-sites to get
the boundaries stitched back together.
This commit is contained in:
Keagan McClelland committed 2024-07-31 14:50:26 -07:00
1 parent 3a15085014
commit 33934449ac
7 files changed
+58 -21

No files matched your search

+5 -2
View File
@@ -11,6 +11,7 @@ import (
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/clock"
"github.com/lightningnetwork/lnd/lntest/mock"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/stretchr/testify/require"
)
@@ -61,12 +62,14 @@ func TestChainArbitratorRepublishCloses(t *testing.T) {
for i := 0; i < numChans/2; i++ {
closeTx := channels[i].FundingTxn.Copy()
closeTx.TxIn[0].PreviousOutPoint = channels[i].FundingOutpoint
err := channels[i].MarkCommitmentBroadcasted(closeTx, true)
err := channels[i].MarkCommitmentBroadcasted(
closeTx, lntypes.Local,
)
if err != nil {
t.Fatal(err)
}
err = channels[i].MarkCoopBroadcasted(closeTx, true)
err = channels[i].MarkCoopBroadcasted(closeTx, lntypes.Local)
if err != nil {
t.Fatal(err)
}
+2 -2
View File
@@ -129,7 +129,7 @@ type ChannelArbitratorConfig struct {
// MarkCommitmentBroadcasted should mark the channel as the commitment
// being broadcast, and we are waiting for the commitment to confirm.
MarkCommitmentBroadcasted func(*wire.MsgTx, bool) error
MarkCommitmentBroadcasted func(*wire.MsgTx, lntypes.ChannelParty) error
// MarkChannelClosed marks the channel closed in the database, with the
// passed close summary. After this method successfully returns we can
@@ -1084,7 +1084,7 @@ func (c *ChannelArbitrator) stateStep(
// database, such that we can re-publish later in case it
// didn't propagate. We initiated the force close, so we
// mark broadcast with local initiator set to true.
err = c.cfg.MarkCommitmentBroadcasted(closeTx, true)
err = c.cfg.MarkCommitmentBroadcasted(closeTx, lntypes.Local)
if err != nil {
log.Errorf("ChannelArbitrator(%v): unable to "+
"mark commitment broadcasted: %v",
+3 -1
View File
@@ -416,7 +416,9 @@ func createTestChannelArbitrator(t *testing.T, log ArbitratorLog,
resolvedChan <- struct{}{}
return nil
},
MarkCommitmentBroadcasted: func(_ *wire.MsgTx, _ bool) error {
MarkCommitmentBroadcasted: func(_ *wire.MsgTx,
_ lntypes.ChannelParty) error {
return nil
},
MarkChannelClosed: func(*channeldb.ChannelCloseSummary,