lnstate

package
v0.0.0-...-ae0a28a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2016 License: MIT Imports: 7 Imported by: 0

README

I'm using this as a temporary repo for the state machine.

All hooks into real stuff isn't used right now.

Will merge into lnwallet/channel.go later?

Documentation

Index

Constants

View Source
const (
	MaxStagedHTLCs               = 1000
	MaxUnrevokedCommitments      = 16
	MaxUpdatedHTLCsPerCommitment = 1000
)

These constants are ...

View Source
const (
	AddPrestage           = 1000
	AddStaged             = 1100
	AddSigningAndRevoking = 1200
	AddComplete           = 1300 //Most HTLCs should be this
	AddRejected           = 1999 //Staging request rejected

	TimeoutPrestage           = 2000
	TimeoutStaged             = 2100
	TimeoutSigningAndRevoking = 2200
	TimeoutComplete           = 2300

	SettlePrestage           = 3000
	SettleStaged             = 3100
	SettleSigningAndRevoking = 3200
	SettleComplete           = 3300
)

PaymentDescriptor states PRESTAGE: We're not sure if the other guy wants to follow through STAGED: Both parties informally agree to add to their commitments SIGNING_AND_REVOKING: In the process of activating the HTLC

Only one state is allowed at a time. timeout/settle can only begin on an ADD_COMPLETE state. If it times out before it hits completion, channel closes out uncooperatively.

NOTE: Current design assumes if value%1000 == 200 as partially signed/revoked, this means that the code is reliant upon this as knowing when to force close out channels, etc.

Variables

This section is empty.

Functions

This section is empty.

Types

type LNChannel

type LNChannel struct {
	sync.RWMutex

	//HTLCs
	//Even/odd numbering in effect
	//Will just take the next number
	HTLCs map[lnwire.HTLCKey]*PaymentDescriptor
	// contains filtered or unexported fields
}

LNChannel ...

func (*LNChannel) CreateHTLC

func (l *LNChannel) CreateHTLC(h *PaymentDescriptor) error

CreateHTLC ...

type PaymentDescriptor

type PaymentDescriptor struct {
	RHashes       []*[20]byte
	Timeout       uint32
	CreditsAmount lnwire.CreditsAmount
	Revocation    []*[20]byte
	Blob          []byte //next hop data
	PayToUs       bool

	State uint32 //Current state

	Index uint32 //Position in txout
	// contains filtered or unexported fields
}

PaymentDescriptor ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL