diff --git a/contractcourt/briefcase.go b/contractcourt/briefcase.go index b263b885d..e0fd6f980 100644 --- a/contractcourt/briefcase.go +++ b/contractcourt/briefcase.go @@ -125,6 +125,59 @@ type ArbitratorLog interface { type ArbitratorState uint8 const ( + // While some state transition is allowed, certain transitions are not + // possible. Listed below is the full state transition map which + // contains all possible paths. We start at StateDefault and end at + // StateFullyResolved, or StateError(not listed as its a possible state + // in every path). The format is, + // -> state: conditions we switch to this state. + // + // StateDefault + // | + // |-> StateDefault: no actions and chain trigger + // | + // |-> StateBroadcastCommit: chain/user trigger + // | | + // | |-> StateCommitmentBroadcasted: chain/user trigger + // | | | + // | | |-> StateCommitmentBroadcasted: chain/user trigger + // | | | + // | | |-> StateContractClosed: local/remote close trigger + // | | | | + // | | | |-> StateWaitingFullResolution: contract resolutions not empty + // | | | | | + // | | | | |-> StateWaitingFullResolution: contract resolutions not empty + // | | | | | + // | | | | |-> StateFullyResolved: contract resolutions empty + // | | | | + // | | | |-> StateFullyResolved: contract resolutions empty + // | | | + // | | |-> StateFullyResolved: coop/breach close trigger + // | | + // | |-> StateContractClosed: local/remote close trigger + // | | | + // | | |-> StateWaitingFullResolution: contract resolutions not empty + // | | | | + // | | | |-> StateWaitingFullResolution: contract resolutions not empty + // | | | | + // | | | |-> StateFullyResolved: contract resolutions empty + // | | | + // | | |-> StateFullyResolved: contract resolutions empty + // | | + // | |-> StateFullyResolved: coop/breach close trigger + // | + // |-> StateContractClosed: local/remote close trigger + // | | + // | |-> StateWaitingFullResolution: contract resolutions empty + // | | | + // | | |-> StateWaitingFullResolution: contract resolutions not empty + // | | | + // | | |-> StateFullyResolved: contract resolutions empty + // | | + // | |-> StateFullyResolved: contract resolutions empty + // | + // |-> StateFullyResolved: coop/breach close trigger + // StateDefault is the default state. In this state, no major actions // need to be executed. StateDefault ArbitratorState = 0 diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index 19d68a554..aabed591f 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -990,7 +990,7 @@ func (c *ChannelArbitrator) stateStep( } // If the resolution is empty, and we have no HTLCs at all to - // tend to, then we're done here. We don't need to launch any + // send to, then we're done here. We don't need to launch any // resolvers, and can go straight to our final state. if contractResolutions.IsEmpty() && confCommitSet.IsEmpty() { log.Infof("ChannelArbitrator(%v): contract "+ @@ -1001,7 +1001,7 @@ func (c *ChannelArbitrator) stateStep( } // Now that we know we'll need to act, we'll process the htlc - // actions, wen create the structures we need to resolve all + // actions, then create the structures we need to resolve all // outstanding contracts. htlcResolvers, pktsToSend, err := c.prepContractResolutions( contractResolutions, triggerHeight, trigger,