mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-28 13:52:55 +02:00
contractcourt: add docs for state transition paths
This commit is contained in:
@@ -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
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user