lightningd: clean up commando rune_counter from datastore on migration.

Pointed out by @ShahanaFarooqui, we leave a single unused entry in the datastore,
so we should clean that up too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-07-25 12:44:38 +09:30
parent 925f9fcce5
commit 11b5f31034
2 changed files with 8 additions and 2 deletions

View File

@ -438,7 +438,7 @@ def test_commando_rune_migration(node_factory):
l1.daemon.wait_for_logs(['Transferring commando rune to db: '] * 2)
# datastore should be empty:
assert l1.rpc.listdatastore(['commando', 'runes']) == {'datastore': []}
assert l1.rpc.listdatastore(['commando']) == {'datastore': []}
# Should match commando results!
assert l1.rpc.showrunes() == {'runes': [{'rune':
@ -463,7 +463,7 @@ def test_commando_blacklist_migration(node_factory):
l1.daemon.wait_for_logs(['Transferring commando blacklist to db: '] * 2)
# datastore should be empty:
assert l1.rpc.listdatastore(['commando', 'blacklist']) == {'datastore': []}
assert l1.rpc.listdatastore(['commando']) == {'datastore': []}
# Should match commando results!
assert l1.rpc.blacklistrune() == {'blacklist': [{'start': 0, 'end': 6},

View File

@ -5722,4 +5722,10 @@ void migrate_datastore_commando_runes(struct lightningd *ld, struct db *db)
db_insert_blacklist(db, &b);
}
db_datastore_remove(db, startkey);
/* Might as well clean up "rune_counter" while we're here, so
* commando datastore is completely clean. */
startkey[0] = "commando";
startkey[1] = "rune_counter";
db_datastore_remove(db, startkey);
}