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:
3 files changed
+227
-3
No files matched your search
+5
-2
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user