Commit ae230d21 authored by Brian Bland's avatar Brian Bland

Allow channel manager to be un-closed on clear

parent e9f8ae50
...@@ -63,6 +63,7 @@ func (s *channelManager) Clear() { ...@@ -63,6 +63,7 @@ func (s *channelManager) Clear() {
s.log.Trace("clearing channel manager state") s.log.Trace("clearing channel manager state")
s.blocks = s.blocks[:0] s.blocks = s.blocks[:0]
s.tip = common.Hash{} s.tip = common.Hash{}
s.closed = false
s.clearPendingChannel() s.clearPendingChannel()
} }
...@@ -83,7 +84,7 @@ func (s *channelManager) TxFailed(id txID) { ...@@ -83,7 +84,7 @@ func (s *channelManager) TxFailed(id txID) {
s.metr.RecordBatchTxFailed() s.metr.RecordBatchTxFailed()
if s.closed && len(s.confirmedTransactions) == 0 && len(s.pendingTransactions) == 0 { if s.closed && len(s.confirmedTransactions) == 0 && len(s.pendingTransactions) == 0 {
s.log.Info("Channel has no submitted transactions, clearing for shutdown", "chID", s.pendingChannel.ID()) s.log.Info("Channel has no submitted transactions, clearing for shutdown", "chID", s.pendingChannel.ID())
s.Clear() s.clearPendingChannel()
} }
} }
...@@ -368,7 +369,7 @@ func (s *channelManager) Close() error { ...@@ -368,7 +369,7 @@ func (s *channelManager) Close() error {
// Any pending state can be proactively cleared if there are no submitted transactions // Any pending state can be proactively cleared if there are no submitted transactions
if len(s.confirmedTransactions) == 0 && len(s.pendingTransactions) == 0 { if len(s.confirmedTransactions) == 0 && len(s.pendingTransactions) == 0 {
s.Clear() s.clearPendingChannel()
} }
if s.pendingChannel == nil { if s.pendingChannel == nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment