lnwallet: move channelState from channeldb to channel.go
This commit is contained in:
parent
3c11006b12
commit
507520cda9
@ -15,11 +15,46 @@ import (
|
|||||||
"github.com/roasbeef/btcutil/txsort"
|
"github.com/roasbeef/btcutil/txsort"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrChanClosing = fmt.Errorf("channel is being closed, operation disallowed")
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// TODO(roasbeef): make not random value
|
// TODO(roasbeef): make not random value
|
||||||
MaxPendingPayments = 10
|
MaxPendingPayments = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// channelState is an enum like type which represents the current state of a
|
||||||
|
// particular channel.
|
||||||
|
type channelState uint8
|
||||||
|
|
||||||
|
const (
|
||||||
|
// channelPending indicates this channel is still going through the
|
||||||
|
// funding workflow, and isn't yet open.
|
||||||
|
channelPending channelState = iota
|
||||||
|
|
||||||
|
// channelOpen represents an open, active channel capable of
|
||||||
|
// sending/receiving HTLCs.
|
||||||
|
channelOpen
|
||||||
|
|
||||||
|
// channelClosing represents a channel which is in the process of being
|
||||||
|
// closed.
|
||||||
|
channelClosing
|
||||||
|
|
||||||
|
// channelClosed represents a channel which has been fully closed. Note
|
||||||
|
// that before a channel can be closed, ALL pending HTLC's must be
|
||||||
|
// settled/removed.
|
||||||
|
channelClosed
|
||||||
|
|
||||||
|
// channelDispute indicates that an un-cooperative closure has been
|
||||||
|
// detected within the channel.
|
||||||
|
channelDispute
|
||||||
|
|
||||||
|
// channelPendingPayment indicates that there a currently outstanding
|
||||||
|
// HTLC's within the channel.
|
||||||
|
channelPendingPayment
|
||||||
|
)
|
||||||
|
|
||||||
// PaymentHash presents the hash160 of a random value. This hash is used to
|
// PaymentHash presents the hash160 of a random value. This hash is used to
|
||||||
// uniquely track incoming/outgoing payments within this channel, as well as
|
// uniquely track incoming/outgoing payments within this channel, as well as
|
||||||
// payments requested by the wallet/daemon.
|
// payments requested by the wallet/daemon.
|
||||||
@ -31,6 +66,9 @@ type LightningChannel struct {
|
|||||||
lnwallet *LightningWallet
|
lnwallet *LightningWallet
|
||||||
channelEvents chainntnfs.ChainNotifier
|
channelEvents chainntnfs.ChainNotifier
|
||||||
|
|
||||||
|
sync.RWMutex
|
||||||
|
status channelState
|
||||||
|
|
||||||
// TODO(roasbeef): Stores all previous R values + timeouts for each
|
// TODO(roasbeef): Stores all previous R values + timeouts for each
|
||||||
// commitment update, plus some other meta-data...Or just use OP_RETURN
|
// commitment update, plus some other meta-data...Or just use OP_RETURN
|
||||||
// to help out?
|
// to help out?
|
||||||
|
Loading…
Reference in New Issue
Block a user