github.com/mit-dci/lit@v0.0.0-20221102210550-8c3d3b49f2ce/lncore/channels.go (about) 1 package lncore 2 3 // LitChannelStorage . 4 type LitChannelStorage interface { 5 GetChannel(handle ChannelHandle) (*ChannelInfo, error) 6 GetChannelHandles() ([]ChannelHandle, error) 7 GetChannels() ([]ChannelInfo, error) 8 9 AddChannel(handle ChannelHandle, info ChannelInfo) error 10 UpdateChannel(handle ChannelHandle, info ChannelInfo) error 11 ArchiveChannel(handle ChannelHandle) error 12 13 GetArchivedChannelHandles() ([]ChannelHandle, error) 14 } 15 16 // ChannelHandle is "something" to concisely uniquely identify a channel. Usually just a txid. 17 type ChannelHandle [64]byte 18 19 // ChannelState . 20 type ChannelState uint8 21 22 const ( 23 // CstateInit means it hasn't been broadcast yet. 24 CstateInit = 0 25 26 // CstateUnconfirmed means it's been broadcast but not included yet. 27 CstateUnconfirmed = 1 28 29 // CstateOK means it's been included and the channel is active. 30 CstateOK = 2 31 32 // CstateClosing means the close tx has been broadcast but not included yet. 33 CstateClosing = 3 34 35 // CstateBreaking means it's the break tx has been broadcast but not included and spendable yet. 36 CstateBreaking = 4 37 38 // CstateClosed means nothing else should be done with the channel anymore. 39 CstateClosed = 5 40 41 // CstateError means something went horribly wrong and we may need extra intervention. 42 CstateError = 255 43 ) 44 45 // ChannelInfo . 46 type ChannelInfo struct { 47 PeerAddr string `json:"peeraddr"` 48 CoinType int32 `json:"cointype"` 49 State ChannelState `json:"state"` 50 OpenTx []byte `json:"opentx"` // should this be here? 51 OpenHeight int32 `json:"openheight"` // -1 if unconfirmed 52 // TODO More. 53 }