mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
contractcourt: remove the immediate
param used in Resolve
This `immediate` flag was added as a hack so during a restart, the pending resolvers would offer the inputs to the sweeper and ask it to sweep them immediately. This is no longer need due to `blockbeat`, as now during restart, a block is always sent to all subsystems via the flow `ChainArb` -> `ChannelArb` -> resolvers -> sweeper. Thus, when there are pending inputs offered, they will be processed by the sweeper immediately.
This commit is contained in:
@@ -816,7 +816,7 @@ func (c *ChannelArbitrator) relaunchResolvers(commitSet *CommitSet,
|
||||
// TODO(roasbeef): this isn't re-launched?
|
||||
}
|
||||
|
||||
c.launchResolvers(unresolvedContracts, true)
|
||||
c.launchResolvers(unresolvedContracts)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1355,7 +1355,7 @@ func (c *ChannelArbitrator) stateStep(
|
||||
|
||||
// Finally, we'll launch all the required contract resolvers.
|
||||
// Once they're all resolved, we're no longer needed.
|
||||
c.launchResolvers(resolvers, false)
|
||||
c.launchResolvers(resolvers)
|
||||
|
||||
nextState = StateWaitingFullResolution
|
||||
|
||||
@@ -1579,16 +1579,14 @@ func (c *ChannelArbitrator) findCommitmentDeadlineAndValue(heightHint uint32,
|
||||
}
|
||||
|
||||
// launchResolvers updates the activeResolvers list and starts the resolvers.
|
||||
func (c *ChannelArbitrator) launchResolvers(resolvers []ContractResolver,
|
||||
immediate bool) {
|
||||
|
||||
func (c *ChannelArbitrator) launchResolvers(resolvers []ContractResolver) {
|
||||
c.activeResolversLock.Lock()
|
||||
defer c.activeResolversLock.Unlock()
|
||||
|
||||
c.activeResolvers = resolvers
|
||||
c.activeResolversLock.Unlock()
|
||||
|
||||
for _, contract := range resolvers {
|
||||
c.wg.Add(1)
|
||||
go c.resolveContract(contract, immediate)
|
||||
go c.resolveContract(contract)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2560,9 +2558,7 @@ func (c *ChannelArbitrator) replaceResolver(oldResolver,
|
||||
// contracts.
|
||||
//
|
||||
// NOTE: This MUST be run as a goroutine.
|
||||
func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver,
|
||||
immediate bool) {
|
||||
|
||||
func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver) {
|
||||
defer c.wg.Done()
|
||||
|
||||
log.Debugf("ChannelArbitrator(%v): attempting to resolve %T",
|
||||
@@ -2583,7 +2579,7 @@ func (c *ChannelArbitrator) resolveContract(currentContract ContractResolver,
|
||||
default:
|
||||
// Otherwise, we'll attempt to resolve the current
|
||||
// contract.
|
||||
nextContract, err := currentContract.Resolve(immediate)
|
||||
nextContract, err := currentContract.Resolve()
|
||||
if err != nil {
|
||||
if err == errResolverShuttingDown {
|
||||
return
|
||||
|
Reference in New Issue
Block a user