channeldb+lnwallet: don't pass isRestoredChan to ChanSyncMsg

Since we have access to the internal state of the channel, we can
instead get it directly instead of passing it in as a parameter.
This commit is contained in:
Johan T. Halseth
2019-09-11 11:15:57 +02:00
parent c90b1dd17d
commit 2a6ad6e634
6 changed files with 32 additions and 45 deletions

View File

@@ -731,9 +731,7 @@ func (c *chainWatcher) dispatchCooperativeClose(commitSpend *chainntnfs.SpendDet
}
// Attempt to add a channel sync message to the close summary.
chanSync, err := c.cfg.chanState.ChanSyncMsg(
c.cfg.chanState.HasChanStatus(channeldb.ChanStatusRestored),
)
chanSync, err := c.cfg.chanState.ChanSyncMsg()
if err != nil {
log.Errorf("ChannelPoint(%v): unable to create channel sync "+
"message: %v", c.cfg.chanState.FundingOutpoint, err)
@@ -810,9 +808,7 @@ func (c *chainWatcher) dispatchLocalForceClose(
}
// Attempt to add a channel sync message to the close summary.
chanSync, err := c.cfg.chanState.ChanSyncMsg(
c.cfg.chanState.HasChanStatus(channeldb.ChanStatusRestored),
)
chanSync, err := c.cfg.chanState.ChanSyncMsg()
if err != nil {
log.Errorf("ChannelPoint(%v): unable to create channel sync "+
"message: %v", c.cfg.chanState.FundingOutpoint, err)
@@ -996,9 +992,7 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail
}
// Attempt to add a channel sync message to the close summary.
chanSync, err := c.cfg.chanState.ChanSyncMsg(
c.cfg.chanState.HasChanStatus(channeldb.ChanStatusRestored),
)
chanSync, err := c.cfg.chanState.ChanSyncMsg()
if err != nil {
log.Errorf("ChannelPoint(%v): unable to create channel sync "+
"message: %v", c.cfg.chanState.FundingOutpoint, err)