contractcourt: add docs for state transition paths
This commit is contained in:
2 files changed
+55
-2
No files matched your search
@@ -125,6 +125,59 @@ type ArbitratorLog interface {
|
|||||||
type ArbitratorState uint8
|
type ArbitratorState uint8
|
||||||
|
|
||||||
const (
|
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
|
// StateDefault is the default state. In this state, no major actions
|
||||||
// need to be executed.
|
// need to be executed.
|
||||||
StateDefault ArbitratorState = 0
|
StateDefault ArbitratorState = 0
|
||||||
|
|||||||
@@ -990,7 +990,7 @@ func (c *ChannelArbitrator) stateStep(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the resolution is empty, and we have no HTLCs at all to
|
// 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.
|
// resolvers, and can go straight to our final state.
|
||||||
if contractResolutions.IsEmpty() && confCommitSet.IsEmpty() {
|
if contractResolutions.IsEmpty() && confCommitSet.IsEmpty() {
|
||||||
log.Infof("ChannelArbitrator(%v): contract "+
|
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
|
// 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.
|
// outstanding contracts.
|
||||||
htlcResolvers, pktsToSend, err := c.prepContractResolutions(
|
htlcResolvers, pktsToSend, err := c.prepContractResolutions(
|
||||||
contractResolutions, triggerHeight, trigger,
|
contractResolutions, triggerHeight, trigger,
|
||||||
|
|||||||
Reference in new issue
Block a user