lnwallet: expose db channel deletion+snapshotting
This commit is contained in:
parent
2ea21422b5
commit
e17bdf08ea
@ -98,7 +98,7 @@ type LightningChannel struct {
|
|||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
// newLightningChannel...
|
// NewLightningChannel...
|
||||||
func NewLightningChannel(wallet *LightningWallet, events chainntnfs.ChainNotifier,
|
func NewLightningChannel(wallet *LightningWallet, events chainntnfs.ChainNotifier,
|
||||||
chanDB *channeldb.DB, state *channeldb.OpenChannel) (*LightningChannel, error) {
|
chanDB *channeldb.DB, state *channeldb.OpenChannel) (*LightningChannel, error) {
|
||||||
|
|
||||||
@ -541,20 +541,6 @@ func (lc *LightningChannel) CancelHTLC() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// OurBalance...
|
|
||||||
func (lc *LightningChannel) OurBalance() btcutil.Amount {
|
|
||||||
lc.stateMtx.RLock()
|
|
||||||
defer lc.stateMtx.RUnlock()
|
|
||||||
return lc.channelState.OurBalance
|
|
||||||
}
|
|
||||||
|
|
||||||
// TheirBalance...
|
|
||||||
func (lc *LightningChannel) TheirBalance() btcutil.Amount {
|
|
||||||
lc.stateMtx.RLock()
|
|
||||||
defer lc.stateMtx.RUnlock()
|
|
||||||
return lc.channelState.TheirBalance
|
|
||||||
}
|
|
||||||
|
|
||||||
// ForceClose...
|
// ForceClose...
|
||||||
func (lc *LightningChannel) ForceClose() error {
|
func (lc *LightningChannel) ForceClose() error {
|
||||||
return nil
|
return nil
|
||||||
@ -660,6 +646,21 @@ func (lc *LightningChannel) CompleteCooperativeClose(remoteSig []byte) (*wire.Ms
|
|||||||
return closeTx, nil
|
return closeTx, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteState deletes all state concerning the channel from the underlying
|
||||||
|
// database, only leaving a small summary describing meta-data of the
|
||||||
|
// channel's lifetime.
|
||||||
|
func (lc *LightningChannel) DeleteState() error {
|
||||||
|
return lc.channelState.CloseChannel()
|
||||||
|
}
|
||||||
|
|
||||||
|
// StateSnapshot returns a snapshot b
|
||||||
|
func (lc *LightningChannel) StateSnapshot() *channeldb.ChannelSnapshot {
|
||||||
|
lc.stateMtx.RLock()
|
||||||
|
defer lc.stateMtx.RUnlock()
|
||||||
|
|
||||||
|
return lc.channelState.Snapshot()
|
||||||
|
}
|
||||||
|
|
||||||
// RequestPayment...
|
// RequestPayment...
|
||||||
func (lc *LightningChannel) RequestPayment(amount btcutil.Amount) error {
|
func (lc *LightningChannel) RequestPayment(amount btcutil.Amount) error {
|
||||||
// Validate amount
|
// Validate amount
|
||||||
|
Loading…
Reference in New Issue
Block a user