diff --git a/contractcourt/breacharbiter.go b/contractcourt/breach_arbitrator.go similarity index 96% rename from contractcourt/breacharbiter.go rename to contractcourt/breach_arbitrator.go index 739e70f131..c8238df432 100644 --- a/contractcourt/breacharbiter.go +++ b/contractcourt/breach_arbitrator.go @@ -53,12 +53,12 @@ var ( // for the first and one for the second level). taprootRetributionBucket = []byte("tap-retribution") - // errBrarShuttingDown is an error returned if the breacharbiter has + // errBrarShuttingDown is an error returned if the BreachArbitrator has // been signalled to exit. - errBrarShuttingDown = errors.New("breacharbiter shutting down") + errBrarShuttingDown = errors.New("BreachArbitrator shutting down") ) -// ContractBreachEvent is an event the BreachArbiter will receive in case a +// ContractBreachEvent is an event the BreachArbitrator will receive in case a // contract breach is observed on-chain. It contains the necessary information // to handle the breach, and a ProcessACK closure we will use to ACK the event // when we have safely stored all the necessary information. @@ -71,7 +71,7 @@ type ContractBreachEvent struct { // store. In case storing the information to the store fails, a non-nil // error should be used. When this closure returns, it means that the // contract court has marked the channel pending close in the DB, and - // it is safe for the BreachArbiter to carry on its duty. + // it is safe for the BreachArbitrator to carry on its duty. ProcessACK func(error) // BreachRetribution is the information needed to act on this contract @@ -94,11 +94,12 @@ const ( ) // RetributionStorer provides an interface for managing a persistent map from -// wire.OutPoint -> retributionInfo. Upon learning of a breach, a BreachArbiter -// should record the retributionInfo for the breached channel, which serves a -// checkpoint in the event that retribution needs to be resumed after failure. -// A RetributionStore provides an interface for managing the persisted set, as -// well as mapping user defined functions over the entire on-disk contents. +// wire.OutPoint -> retributionInfo. Upon learning of a breach, a +// BreachArbitrator should record the retributionInfo for the breached channel, +// which serves a checkpoint in the event that retribution needs to be resumed +// after failure. A RetributionStore provides an interface for managing the +// persisted set, as well as mapping user defined functions over the entire +// on-disk contents. // // Calls to RetributionStore may occur concurrently. A concrete instance of // RetributionStore should use appropriate synchronization primitives, or @@ -125,7 +126,8 @@ type RetributionStorer interface { } // BreachConfig bundles the required subsystems used by the breach arbiter. An -// instance of BreachConfig is passed to newBreachArbiter during instantiation. +// instance of BreachConfig is passed to NewBreachArbitrator during +// instantiation. type BreachConfig struct { // CloseLink allows the breach arbiter to shutdown any channel links for // which it detects a breach, ensuring now further activity will @@ -154,9 +156,9 @@ type BreachConfig struct { // transaction to the network. PublishTransaction func(*wire.MsgTx, string) error - // ContractBreaches is a channel where the BreachArbiter will receive + // ContractBreaches is a channel where the BreachArbitrator will receive // notifications in the event of a contract breach being observed. A - // ContractBreachEvent must be ACKed by the BreachArbiter, such that + // ContractBreachEvent must be ACKed by the BreachArbitrator, such that // the sending subsystem knows that the event is properly handed off. ContractBreaches <-chan *ContractBreachEvent @@ -171,7 +173,7 @@ type BreachConfig struct { Store RetributionStorer } -// BreachArbiter is a special subsystem which is responsible for watching and +// BreachArbitrator is a special subsystem which is responsible for watching and // acting on the detection of any attempted uncooperative channel breaches by // channel counterparties. This file essentially acts as deterrence code for // those attempting to launch attacks against the daemon. In practice it's @@ -179,7 +181,7 @@ type BreachConfig struct { // important to have it in place just in case we encounter cheating channel // counterparties. // TODO(roasbeef): closures in config for subsystem pointers to decouple? -type BreachArbiter struct { +type BreachArbitrator struct { started sync.Once stopped sync.Once @@ -192,19 +194,19 @@ type BreachArbiter struct { sync.Mutex } -// NewBreachArbiter creates a new instance of a BreachArbiter initialized with -// its dependent objects. -func NewBreachArbiter(cfg *BreachConfig) *BreachArbiter { - return &BreachArbiter{ +// NewBreachArbitrator creates a new instance of a BreachArbitrator initialized +// with its dependent objects. +func NewBreachArbitrator(cfg *BreachConfig) *BreachArbitrator { + return &BreachArbitrator{ cfg: cfg, subscriptions: make(map[wire.OutPoint]chan struct{}), quit: make(chan struct{}), } } -// Start is an idempotent method that officially starts the BreachArbiter along -// with all other goroutines it needs to perform its functions. -func (b *BreachArbiter) Start() error { +// Start is an idempotent method that officially starts the BreachArbitrator +// along with all other goroutines it needs to perform its functions. +func (b *BreachArbitrator) Start() error { var err error b.started.Do(func() { brarLog.Info("Breach arbiter starting") @@ -213,7 +215,7 @@ func (b *BreachArbiter) Start() error { return err } -func (b *BreachArbiter) start() error { +func (b *BreachArbitrator) start() error { // Load all retributions currently persisted in the retribution store. var breachRetInfos map[wire.OutPoint]retributionInfo if err := b.cfg.Store.ForAll(func(ret *retributionInfo) error { @@ -305,10 +307,10 @@ func (b *BreachArbiter) start() error { return nil } -// Stop is an idempotent method that signals the BreachArbiter to execute a +// Stop is an idempotent method that signals the BreachArbitrator to execute a // graceful shutdown. This function will block until all goroutines spawned by -// the BreachArbiter have gracefully exited. -func (b *BreachArbiter) Stop() error { +// the BreachArbitrator have gracefully exited. +func (b *BreachArbitrator) Stop() error { b.stopped.Do(func() { brarLog.Infof("Breach arbiter shutting down...") defer brarLog.Debug("Breach arbiter shutdown complete") @@ -321,13 +323,13 @@ func (b *BreachArbiter) Stop() error { // IsBreached queries the breach arbiter's retribution store to see if it is // aware of any channel breaches for a particular channel point. -func (b *BreachArbiter) IsBreached(chanPoint *wire.OutPoint) (bool, error) { +func (b *BreachArbitrator) IsBreached(chanPoint *wire.OutPoint) (bool, error) { return b.cfg.Store.IsBreached(chanPoint) } // SubscribeBreachComplete is used by outside subsystems to be notified of a // successful breach resolution. -func (b *BreachArbiter) SubscribeBreachComplete(chanPoint *wire.OutPoint, +func (b *BreachArbitrator) SubscribeBreachComplete(chanPoint *wire.OutPoint, c chan struct{}) (bool, error) { breached, err := b.cfg.Store.IsBreached(chanPoint) @@ -353,9 +355,9 @@ func (b *BreachArbiter) SubscribeBreachComplete(chanPoint *wire.OutPoint, return false, nil } -// notifyBreachComplete is used by the BreachArbiter to notify outside +// notifyBreachComplete is used by the BreachArbitrator to notify outside // subsystems that the breach resolution process is complete. -func (b *BreachArbiter) notifyBreachComplete(chanPoint *wire.OutPoint) { +func (b *BreachArbitrator) notifyBreachComplete(chanPoint *wire.OutPoint) { b.Lock() defer b.Unlock() if c, ok := b.subscriptions[*chanPoint]; ok { @@ -366,7 +368,7 @@ func (b *BreachArbiter) notifyBreachComplete(chanPoint *wire.OutPoint) { delete(b.subscriptions, *chanPoint) } -// contractObserver is the primary goroutine for the BreachArbiter. This +// contractObserver is the primary goroutine for the BreachArbitrator. This // goroutine is responsible for handling breach events coming from the // contractcourt on the ContractBreaches channel. If a channel breach is // detected, then the contractObserver will execute the retribution logic @@ -374,7 +376,7 @@ func (b *BreachArbiter) notifyBreachComplete(chanPoint *wire.OutPoint) { // wallet. // // NOTE: This MUST be run as a goroutine. -func (b *BreachArbiter) contractObserver() { +func (b *BreachArbitrator) contractObserver() { defer b.wg.Done() brarLog.Infof("Starting contract observer, watching for breaches.") @@ -406,7 +408,7 @@ type spend struct { // returns the spend details for those outputs. The spendNtfns map is a cache // used to store registered spend subscriptions, in case we must call this // method multiple times. -func (b *BreachArbiter) waitForSpendEvent(breachInfo *retributionInfo, +func (b *BreachArbitrator) waitForSpendEvent(breachInfo *retributionInfo, spendNtfns map[wire.OutPoint]*chainntnfs.SpendEvent) ([]spend, error) { inputs := breachInfo.breachedOutputs @@ -684,8 +686,10 @@ func updateBreachInfo(breachInfo *retributionInfo, spends []spend) ( // the lingering funds within the channel into the daemon's wallet. // // NOTE: This MUST be run as a goroutine. -func (b *BreachArbiter) exactRetribution(confChan *chainntnfs.ConfirmationEvent, - breachInfo *retributionInfo) { +// +//nolint:funlen +func (b *BreachArbitrator) exactRetribution( + confChan *chainntnfs.ConfirmationEvent, breachInfo *retributionInfo) { defer b.wg.Done() @@ -916,7 +920,7 @@ Loop: // cleanupBreach marks the given channel point as fully resolved and removes the // retribution for that the channel from the retribution store. -func (b *BreachArbiter) cleanupBreach(chanPoint *wire.OutPoint) error { +func (b *BreachArbitrator) cleanupBreach(chanPoint *wire.OutPoint) error { // With the channel closed, mark it in the database as such. err := b.cfg.DB.MarkChanFullyClosed(chanPoint) if err != nil { @@ -943,15 +947,17 @@ func (b *BreachArbiter) cleanupBreach(chanPoint *wire.OutPoint) error { } // handleBreachHandoff handles a new breach event, by writing it to disk, then -// notifies the BreachArbiter contract observer goroutine that a channel's +// notifies the BreachArbitrator contract observer goroutine that a channel's // contract has been breached by the prior counterparty. Once notified the -// BreachArbiter will attempt to sweep ALL funds within the channel using the +// BreachArbitrator will attempt to sweep ALL funds within the channel using the // information provided within the BreachRetribution generated due to the // breach of channel contract. The funds will be swept only after the breaching // transaction receives a necessary number of confirmations. // // NOTE: This MUST be run as a goroutine. -func (b *BreachArbiter) handleBreachHandoff(breachEvent *ContractBreachEvent) { +func (b *BreachArbitrator) handleBreachHandoff( + breachEvent *ContractBreachEvent) { + defer b.wg.Done() chanPoint := breachEvent.ChanPoint @@ -1367,7 +1373,7 @@ type justiceTxVariants struct { // the funds within the channel which we are now entitled to due to a breach of // the channel's contract by the counterparty. This function returns a *fully* // signed transaction with the witness for each input fully in place. -func (b *BreachArbiter) createJusticeTx( +func (b *BreachArbitrator) createJusticeTx( breachedOutputs []breachedOutput) (*justiceTxVariants, error) { var ( @@ -1442,7 +1448,7 @@ func (b *BreachArbiter) createJusticeTx( } // createSweepTx creates a tx that sweeps the passed inputs back to our wallet. -func (b *BreachArbiter) createSweepTx(inputs ...input.Input) (*wire.MsgTx, +func (b *BreachArbitrator) createSweepTx(inputs ...input.Input) (*wire.MsgTx, error) { if len(inputs) == 0 { @@ -1498,7 +1504,7 @@ func (b *BreachArbiter) createSweepTx(inputs ...input.Input) (*wire.MsgTx, // sweepSpendableOutputsTxn creates a signed transaction from a sequence of // spendable outputs by sweeping the funds into a single p2wkh output. -func (b *BreachArbiter) sweepSpendableOutputsTxn(txWeight int64, +func (b *BreachArbitrator) sweepSpendableOutputsTxn(txWeight int64, inputs ...input.Input) (*wire.MsgTx, error) { // First, we obtain a new public key script from the wallet which we'll diff --git a/contractcourt/breacharbiter_test.go b/contractcourt/breach_arbitrator_test.go similarity index 99% rename from contractcourt/breacharbiter_test.go rename to contractcourt/breach_arbitrator_test.go index 78fa9d7079..29f33881a0 100644 --- a/contractcourt/breacharbiter_test.go +++ b/contractcourt/breach_arbitrator_test.go @@ -951,7 +951,7 @@ restartCheck: } } -func initBreachedState(t *testing.T) (*BreachArbiter, +func initBreachedState(t *testing.T) (*BreachArbitrator, *lnwallet.LightningChannel, *lnwallet.LightningChannel, *lnwallet.LocalForceCloseSummary, chan *ContractBreachEvent) { @@ -1338,7 +1338,7 @@ func getSpendTransactions(signer input.Signer, chanPoint *wire.OutPoint, }, } - // In order for the breacharbiter to detect that it is being spent + // In order for the BreachArbitrator to detect that it is being spent // using the revocation key, it will inspect the witness. Therefore // sign and add the witness to the HTLC sweep. retInfo := newRetributionInfo(chanPoint, retribution) @@ -1684,7 +1684,7 @@ func testBreachSpends(t *testing.T, test breachTest) { } // We also keep a map of those remaining outputs we expect the - // breacharbiter to try and sweep. + // BreachArbitrator to try and sweep. inputsToSweep := map[wire.OutPoint]struct{}{ htlcOutpoint: {}, localOutpoint: {}, @@ -1892,7 +1892,7 @@ func TestBreachDelayedJusticeConfirmation(t *testing.T) { } // Now mine another block without the justice tx confirming. This - // should lead to the breacharbiter publishing the split justice tx + // should lead to the BreachArbitrator publishing the split justice tx // variants. notifier.EpochChan <- &chainntnfs.BlockEpoch{ Height: blockHeight + 4, @@ -1988,7 +1988,7 @@ func findInputIndex(t *testing.T, op wire.OutPoint, tx *wire.MsgTx) int { // assertArbiterBreach checks that the breach arbiter has persisted the breach // information for a particular channel. -func assertArbiterBreach(t *testing.T, brar *BreachArbiter, +func assertArbiterBreach(t *testing.T, brar *BreachArbitrator, chanPoint *wire.OutPoint) { t.Helper() @@ -2008,7 +2008,7 @@ func assertArbiterBreach(t *testing.T, brar *BreachArbiter, // assertNoArbiterBreach checks that the breach arbiter has not persisted the // breach information for a particular channel. -func assertNoArbiterBreach(t *testing.T, brar *BreachArbiter, +func assertNoArbiterBreach(t *testing.T, brar *BreachArbitrator, chanPoint *wire.OutPoint) { t.Helper() @@ -2027,7 +2027,7 @@ func assertNoArbiterBreach(t *testing.T, brar *BreachArbiter, // assertBrarCleanup blocks until the given channel point has been removed the // retribution store and the channel is fully closed in the database. -func assertBrarCleanup(t *testing.T, brar *BreachArbiter, +func assertBrarCleanup(t *testing.T, brar *BreachArbitrator, chanPoint *wire.OutPoint, db *channeldb.ChannelStateDB) { t.Helper() @@ -2108,7 +2108,7 @@ func assertNotPendingClosed(t *testing.T, c *lnwallet.LightningChannel) { // createTestArbiter instantiates a breach arbiter with a failing retribution // store, so that controlled failures can be tested. func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent, - db *channeldb.DB) (*BreachArbiter, error) { + db *channeldb.DB) (*BreachArbitrator, error) { // Create a failing retribution store, that wraps a normal one. store := newFailingRetributionStore(func() RetributionStorer { @@ -2120,7 +2120,7 @@ func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent, // Assemble our test arbiter. notifier := mock.MakeMockSpendNotifier() - ba := NewBreachArbiter(&BreachConfig{ + ba := NewBreachArbitrator(&BreachConfig{ CloseLink: func(_ *wire.OutPoint, _ ChannelCloseType) {}, DB: db.ChannelStateDB(), Estimator: chainfee.NewStaticEstimator(12500, 0), diff --git a/contractcourt/breach_resolver.go b/contractcourt/breach_resolver.go index 922ec609ab..c76d20a6a7 100644 --- a/contractcourt/breach_resolver.go +++ b/contractcourt/breach_resolver.go @@ -8,13 +8,14 @@ import ( ) // breachResolver is a resolver that will handle breached closes. In the -// future, this will likely take over the duties the current breacharbiter has. +// future, this will likely take over the duties the current BreachArbitrator +// has. type breachResolver struct { // resolved reflects if the contract has been fully resolved or not. resolved bool // subscribed denotes whether or not the breach resolver has subscribed - // to the breacharbiter for breach resolution. + // to the BreachArbitrator for breach resolution. subscribed bool // replyChan is closed when the breach arbiter has completed serving @@ -42,8 +43,8 @@ func (b *breachResolver) ResolverKey() []byte { return key[:] } -// Resolve queries the breacharbiter to see if the justice transaction has been -// broadcast. +// Resolve queries the BreachArbitrator to see if the justice transaction has +// been broadcast. func (b *breachResolver) Resolve() (ContractResolver, error) { if !b.subscribed { complete, err := b.SubscribeBreachComplete( diff --git a/contractcourt/chain_arbitrator.go b/contractcourt/chain_arbitrator.go index acf3512af2..1fa348b3f5 100644 --- a/contractcourt/chain_arbitrator.go +++ b/contractcourt/chain_arbitrator.go @@ -100,10 +100,10 @@ type ChainArbitratorConfig struct { MarkLinkInactive func(wire.OutPoint) error // ContractBreach is a function closure that the ChainArbitrator will - // use to notify the breachArbiter about a contract breach. It should - // only return a non-nil error when the breachArbiter has preserved + // use to notify the BreachArbitrator about a contract breach. It should + // only return a non-nil error when the BreachArbitrator has preserved // the necessary breach info for this channel point. Once the breach - // resolution is persisted in the channel arbitrator, it will be safe + // resolution is persisted in the ChannelArbitrator, it will be safe // to mark the channel closed. ContractBreach func(wire.OutPoint, *lnwallet.BreachRetribution) error diff --git a/contractcourt/chain_watcher.go b/contractcourt/chain_watcher.go index 71f2f9a83d..b560795dff 100644 --- a/contractcourt/chain_watcher.go +++ b/contractcourt/chain_watcher.go @@ -175,7 +175,7 @@ type chainWatcherConfig struct { // contractBreach is a method that will be called by the watcher if it // detects that a contract breach transaction has been confirmed. It - // will only return a non-nil error when the breachArbiter has + // will only return a non-nil error when the BreachArbitrator has // preserved the necessary breach info for this channel point. contractBreach func(*lnwallet.BreachRetribution) error @@ -1243,14 +1243,14 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail closeSummary.LastChanSyncMsg = chanSync } - // Hand the retribution info over to the breach arbiter. This function + // Hand the retribution info over to the BreachArbitrator. This function // will wait for a response from the breach arbiter and then proceed to // send a BreachCloseInfo to the channel arbitrator. The channel arb // will then mark the channel as closed after resolutions and the // commit set are logged in the arbitrator log. if err := c.cfg.contractBreach(retribution); err != nil { log.Errorf("unable to hand breached contract off to "+ - "breachArbiter: %v", err) + "BreachArbitrator: %v", err) return err } diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index a15031a2e6..e6f91d3cd0 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -860,7 +860,7 @@ const ( // breachCloseTrigger is a transition trigger driven by a remote breach // being confirmed. In this case the channel arbitrator will wait for - // the breacharbiter to finish and then clean up gracefully. + // the BreachArbitrator to finish and then clean up gracefully. breachCloseTrigger ) @@ -2891,7 +2891,7 @@ func (c *ChannelArbitrator) channelAttendant(bestHeight int32) { } // The remote has breached the channel. As this is handled by - // the ChainWatcher and BreachArbiter, we don't have to do + // the ChainWatcher and BreachArbitrator, we don't have to do // anything in particular, so just advance our state and // gracefully exit. case breachInfo := <-c.cfg.ChainEvents.ContractBreach: @@ -2926,7 +2926,7 @@ func (c *ChannelArbitrator) channelAttendant(bestHeight int32) { } // The channel is finally marked pending closed here as - // the breacharbiter and channel arbitrator have + // the BreachArbitrator and channel arbitrator have // persisted the relevant states. closeSummary := &breachInfo.CloseSummary err = c.cfg.MarkChannelClosed( diff --git a/contractcourt/channel_arbitrator_test.go b/contractcourt/channel_arbitrator_test.go index 34c6122fda..8c72e02f67 100644 --- a/contractcourt/channel_arbitrator_test.go +++ b/contractcourt/channel_arbitrator_test.go @@ -1430,7 +1430,7 @@ func TestChannelArbitratorPersistence(t *testing.T) { // is breached by the remote node. In these cases we expect the // ChannelArbitrator to properly execute the breachResolver flow and then // gracefully exit once the breachResolver receives the signal from what would -// normally be the breacharbiter. +// normally be the BreachArbitrator. func TestChannelArbitratorForceCloseBreachedChannel(t *testing.T) { log := &mockArbitratorLog{ state: StateDefault, diff --git a/lnrpc/walletrpc/walletkit_server.go b/lnrpc/walletrpc/walletkit_server.go index 9d70baa733..88065572df 100644 --- a/lnrpc/walletrpc/walletkit_server.go +++ b/lnrpc/walletrpc/walletkit_server.go @@ -201,7 +201,7 @@ var ( // are numbered differently. The protobuf enum cannot be renumbered // because this would break backwards compatibility with older clients, // and the native enum cannot be renumbered because it is stored in the - // watchtower and breacharbiter databases. + // watchtower and BreachArbitrator databases. // //nolint:lll allWitnessTypes = map[input.WitnessType]WitnessType{ diff --git a/server.go b/server.go index b8ca7bdb81..f7f78d6dd5 100644 --- a/server.go +++ b/server.go @@ -262,7 +262,7 @@ type server struct { witnessBeacon contractcourt.WitnessBeacon - breachArbiter *contractcourt.BreachArbiter + breachArbitrator *contractcourt.BreachArbitrator missionControl *routing.MissionControl @@ -1099,22 +1099,24 @@ func newServer(cfg *Config, listenAddrs []net.Addr, } // We will use the following channel to reliably hand off contract - // breach events from the ChannelArbitrator to the breachArbiter, + // breach events from the ChannelArbitrator to the BreachArbitrator, contractBreaches := make(chan *contractcourt.ContractBreachEvent, 1) - s.breachArbiter = contractcourt.NewBreachArbiter(&contractcourt.BreachConfig{ - CloseLink: closeLink, - DB: s.chanStateDB, - Estimator: s.cc.FeeEstimator, - GenSweepScript: newSweepPkScriptGen(cc.Wallet), - Notifier: cc.ChainNotifier, - PublishTransaction: cc.Wallet.PublishTransaction, - ContractBreaches: contractBreaches, - Signer: cc.Wallet.Cfg.Signer, - Store: contractcourt.NewRetributionStore( - dbs.ChanStateDB, - ), - }) + s.breachArbitrator = contractcourt.NewBreachArbitrator( + &contractcourt.BreachConfig{ + CloseLink: closeLink, + DB: s.chanStateDB, + Estimator: s.cc.FeeEstimator, + GenSweepScript: newSweepPkScriptGen(cc.Wallet), + Notifier: cc.ChainNotifier, + PublishTransaction: cc.Wallet.PublishTransaction, + ContractBreaches: contractBreaches, + Signer: cc.Wallet.Cfg.Signer, + Store: contractcourt.NewRetributionStore( + dbs.ChanStateDB, + ), + }, + ) s.chainArb = contractcourt.NewChainArbitrator(contractcourt.ChainArbitratorConfig{ ChainHash: *s.cfg.ActiveNetParams.GenesisHash, @@ -1167,8 +1169,8 @@ func newServer(cfg *Config, listenAddrs []net.Addr, ContractBreach: func(chanPoint wire.OutPoint, breachRet *lnwallet.BreachRetribution) error { - // processACK will handle the breachArbiter ACKing the - // event. + // processACK will handle the BreachArbitrator ACKing + // the event. finalErr := make(chan error, 1) processACK := func(brarErr error) { if brarErr != nil { @@ -1176,7 +1178,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, return } - // If the breachArbiter successfully handled + // If the BreachArbitrator successfully handled // the event, we can signal that the handoff // was successful. finalErr <- nil @@ -1188,7 +1190,8 @@ func newServer(cfg *Config, listenAddrs []net.Addr, BreachRetribution: breachRet, } - // Send the contract breach event to the breachArbiter. + // Send the contract breach event to the + // BreachArbitrator. select { case contractBreaches <- event: case <-s.quit: @@ -1196,7 +1199,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, } // We'll wait for a final error to be available from - // the breachArbiter. + // the BreachArbitrator. select { case err := <-finalErr: return err @@ -1215,8 +1218,8 @@ func newServer(cfg *Config, listenAddrs []net.Addr, PaymentsExpirationGracePeriod: cfg.PaymentsExpirationGracePeriod, IsForwardedHTLC: s.htlcSwitch.IsForwardedHTLC, Clock: clock.NewDefaultClock(), - SubscribeBreachComplete: s.breachArbiter.SubscribeBreachComplete, - PutFinalHtlcOutcome: s.chanStateDB.PutOnchainFinalHtlcOutcome, //nolint: lll + SubscribeBreachComplete: s.breachArbitrator.SubscribeBreachComplete, //nolint:lll + PutFinalHtlcOutcome: s.chanStateDB.PutOnchainFinalHtlcOutcome, //nolint: lll HtlcNotifier: s.htlcNotifier, }, dbs.ChanStateDB) @@ -1936,11 +1939,11 @@ func (s *server) Start() error { } cleanup = cleanup.add(s.utxoNursery.Stop) - if err := s.breachArbiter.Start(); err != nil { + if err := s.breachArbitrator.Start(); err != nil { startErr = err return } - cleanup = cleanup.add(s.breachArbiter.Stop) + cleanup = cleanup.add(s.breachArbitrator.Stop) if err := s.fundingMgr.Start(); err != nil { startErr = err @@ -2244,8 +2247,9 @@ func (s *server) Stop() error { if err := s.fundingMgr.Stop(); err != nil { srvrLog.Warnf("failed to stop fundingMgr: %v", err) } - if err := s.breachArbiter.Stop(); err != nil { - srvrLog.Warnf("failed to stop breachArbiter: %v", err) + if err := s.breachArbitrator.Stop(); err != nil { + srvrLog.Warnf("failed to stop breachArbitrator: %v", + err) } if err := s.utxoNursery.Stop(); err != nil { srvrLog.Warnf("failed to stop utxoNursery: %v", err)