mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-13 18:31:51 +02:00
contractcourt: fully use chanPoint variable
When we create a temporary chanPoint variable to shorten up the code, we should use it everywhere for consistency and clarity.
This commit is contained in:
parent
f9d4600ff8
commit
da10cb95b5
@ -342,14 +342,13 @@ func (a *arbChannel) ForceCloseChan() (*lnwallet.LocalForceCloseSummary, error)
|
|||||||
func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
|
func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
|
||||||
c *ChainArbitrator, chanEvents *ChainEventSubscription) (*ChannelArbitrator, error) {
|
c *ChainArbitrator, chanEvents *ChainEventSubscription) (*ChannelArbitrator, error) {
|
||||||
|
|
||||||
log.Tracef("Creating ChannelArbitrator for ChannelPoint(%v)",
|
|
||||||
channel.FundingOutpoint)
|
|
||||||
|
|
||||||
// TODO(roasbeef): fetch best height (or pass in) so can ensure block
|
// TODO(roasbeef): fetch best height (or pass in) so can ensure block
|
||||||
// epoch delivers all the notifications to
|
// epoch delivers all the notifications to
|
||||||
|
|
||||||
chanPoint := channel.FundingOutpoint
|
chanPoint := channel.FundingOutpoint
|
||||||
|
|
||||||
|
log.Tracef("Creating ChannelArbitrator for ChannelPoint(%v)", chanPoint)
|
||||||
|
|
||||||
// Next we'll create the matching configuration struct that contains
|
// Next we'll create the matching configuration struct that contains
|
||||||
// all interfaces and methods the arbitrator needs to do its job.
|
// all interfaces and methods the arbitrator needs to do its job.
|
||||||
arbCfg := ChannelArbitratorConfig{
|
arbCfg := ChannelArbitratorConfig{
|
||||||
@ -375,8 +374,7 @@ func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
|
|||||||
report *channeldb.ResolverReport) error {
|
report *channeldb.ResolverReport) error {
|
||||||
|
|
||||||
return c.chanSource.PutResolverReport(
|
return c.chanSource.PutResolverReport(
|
||||||
tx, c.cfg.ChainHash, &channel.FundingOutpoint,
|
tx, c.cfg.ChainHash, &chanPoint, report,
|
||||||
report,
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
FetchHistoricalChannel: func() (*channeldb.OpenChannel, error) {
|
FetchHistoricalChannel: func() (*channeldb.OpenChannel, error) {
|
||||||
@ -1125,12 +1123,13 @@ func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error
|
|||||||
c.Lock()
|
c.Lock()
|
||||||
defer c.Unlock()
|
defer c.Unlock()
|
||||||
|
|
||||||
|
chanPoint := newChan.FundingOutpoint
|
||||||
|
|
||||||
log.Infof("Creating new ChannelArbitrator for ChannelPoint(%v)",
|
log.Infof("Creating new ChannelArbitrator for ChannelPoint(%v)",
|
||||||
newChan.FundingOutpoint)
|
chanPoint)
|
||||||
|
|
||||||
// If we're already watching this channel, then we'll ignore this
|
// If we're already watching this channel, then we'll ignore this
|
||||||
// request.
|
// request.
|
||||||
chanPoint := newChan.FundingOutpoint
|
|
||||||
if _, ok := c.activeChannels[chanPoint]; ok {
|
if _, ok := c.activeChannels[chanPoint]; ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1157,7 +1156,7 @@ func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.activeWatchers[newChan.FundingOutpoint] = chainWatcher
|
c.activeWatchers[chanPoint] = chainWatcher
|
||||||
|
|
||||||
// We'll also create a new channel arbitrator instance using this new
|
// We'll also create a new channel arbitrator instance using this new
|
||||||
// channel, and our internal state.
|
// channel, and our internal state.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user