diff --git a/tests/test_runes.py b/tests/test_runes.py index d9efbb657..68e6ef432 100644 --- a/tests/test_runes.py +++ b/tests/test_runes.py @@ -471,7 +471,6 @@ def test_commando_blacklist_migration(node_factory): {'start': 9, 'end': 9}]} -@pytest.mark.xfail(strict=True) def test_showrune_id(node_factory): l1 = node_factory.get_node() diff --git a/wallet/wallet.c b/wallet/wallet.c index 6275f29fc..32d91135a 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -5712,20 +5712,20 @@ const char **wallet_get_runes(const tal_t *ctx, struct wallet *wallet) return strs; } -static void db_rune_insert(struct db *db, struct rune *rune) +static void db_rune_insert(struct db *db, + const struct rune *rune) { struct db_stmt *stmt; - assert(rune->unique_id != NULL); - stmt = db_prepare_v2(db, - SQL("INSERT INTO runes (rune) VALUES (?);")); + SQL("INSERT INTO runes (id, rune) VALUES (?, ?);")); + db_bind_u64(stmt, atol(rune->unique_id)); db_bind_text(stmt, rune_to_base64(tmpctx, rune)); db_exec_prepared_v2(stmt); tal_free(stmt); } -void wallet_rune_insert(struct wallet *wallet, struct rune *rune) +void wallet_rune_insert(struct wallet *wallet, const struct rune *rune) { db_rune_insert(wallet->db, rune); } diff --git a/wallet/wallet.h b/wallet/wallet.h index 2f5d65e81..9c05a6762 100644 --- a/wallet/wallet.h +++ b/wallet/wallet.h @@ -1603,7 +1603,7 @@ const char **wallet_get_runes(const tal_t *ctx, struct wallet *wallet); * @wallet: the wallet to save into * @rune: the instance to store */ -void wallet_rune_insert(struct wallet *wallet, struct rune *rune); +void wallet_rune_insert(struct wallet *wallet, const struct rune *rune); /* Load the runes blacklist */ struct rune_blacklist {