channeldb: add ability to close active channels

This commit introduces the concept of “closing” an already active
channel. Closing a channel causes all the channel state to be purged
from the database, and also triggers the creation of a small “summary”
kept concerning details of the previously open channel.

This commit also updates the previous test case(s), and includes the
close channel bucket in the database deletion in the .Wipe() method.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-06-22 16:16:43 -07:00
1 parent 7e09a70706
commit f1f27b2046
3 files changed
+227 -3

No files matched your search

+5 -2
View File
@@ -72,8 +72,11 @@ func (d *DB) RegisterCryptoSystem(ed EncryptorDecryptor) {
// Wipe...
func (d *DB) Wipe() error {
return d.store.Update(func(tx *bolt.Tx) error {
// TODO(roasbee): delete all other top-level buckets.
return tx.DeleteBucket(openChannelBucket)
if err := tx.DeleteBucket(openChannelBucket); err != nil {
return err
}
return tx.DeleteBucket(closedChannelBucket)
})
}