multi: move all channelstate operations to ChannelStateDB

This commit is contained in:
Andras Banki-Horvath authored and Oliver Gugger committed 2021-09-29 17:00:03 +02:00
1 parent ddea833d31
commit 11cf4216e4
35 files changed
+377 -238

No files matched your search

+11 -5
View File
@@ -258,7 +258,9 @@ func (a *arbChannel) NewAnchorResolutions() (*lnwallet.AnchorResolutions,
// same instance that is used by the link.
chanPoint := a.channel.FundingOutpoint
channel, err := a.c.chanSource.FetchChannel(nil, chanPoint)
channel, err := a.c.chanSource.ChannelStateDB().FetchChannel(
nil, chanPoint,
)
if err != nil {
return nil, err
}
@@ -301,7 +303,9 @@ func (a *arbChannel) ForceCloseChan() (*lnwallet.LocalForceCloseSummary, error)
// Now that we know the link can't mutate the channel
// state, we'll read the channel from disk the target
// channel according to its channel point.
channel, err := a.c.chanSource.FetchChannel(nil, chanPoint)
channel, err := a.c.chanSource.ChannelStateDB().FetchChannel(
nil, chanPoint,
)
if err != nil {
return nil, err
}
@@ -422,7 +426,7 @@ func (c *ChainArbitrator) ResolveContract(chanPoint wire.OutPoint) error {
// First, we'll we'll mark the channel as fully closed from the PoV of
// the channel source.
err := c.chanSource.MarkChanFullyClosed(&chanPoint)
err := c.chanSource.ChannelStateDB().MarkChanFullyClosed(&chanPoint)
if err != nil {
log.Errorf("ChainArbitrator: unable to mark ChannelPoint(%v) "+
"fully closed: %v", chanPoint, err)
@@ -480,7 +484,7 @@ func (c *ChainArbitrator) Start() error {
// First, we'll fetch all the channels that are still open, in order to
// collect them within our set of active contracts.
openChannels, err := c.chanSource.FetchAllChannels()
openChannels, err := c.chanSource.ChannelStateDB().FetchAllChannels()
if err != nil {
return err
}
@@ -538,7 +542,9 @@ func (c *ChainArbitrator) Start() error {
// In addition to the channels that we know to be open, we'll also
// launch arbitrators to finishing resolving any channels that are in
// the pending close state.
closingChannels, err := c.chanSource.FetchClosedChannels(true)
closingChannels, err := c.chanSource.ChannelStateDB().FetchClosedChannels(
true,
)
if err != nil {
return err
}