Keep attachment SQL fixtures consistent with group admission

This commit is contained in:
evgeny committed 2026-11-03 21:07:30 +01:00
1 parent 3d60298d21
commit aebc3fcd89
2 files changed
+9 -3

No files matched your search

+4
View File
@@ -251,6 +251,10 @@ static void setup(struct fixture* f) {
assert(sqlite3_bind_blob(st, 2, f->id, 16, SQLITE_STATIC) == SQLITE_OK && sqlite3_bind_blob(st, 3, f->message, 32, SQLITE_STATIC) == SQLITE_OK);
assert(sqlite3_bind_blob(st, 4, f->hash, 32, SQLITE_STATIC) == SQLITE_OK && sqlite3_step(st) == SQLITE_DONE && sqlite3_finalize(st) == SQLITE_OK);
char query[512];
/* Этот SQL-стенд входит после router и использует фиксированный peer123; crypto проверяет сетевой тест. */
snprintf(query, sizeof(query), "INSERT INTO peers_%s(node_id,x25519_pubkey,ed25519_pubkey,join_sig,join_ts,source,admitted)"
" VALUES(123,zeroblob(32),zeroblob(32),zeroblob(64),1,0,1)", f->channel);
sql(f->inst->topo_sqlite_db, query);
snprintf(query, sizeof(query), "INSERT INTO attachment_key_requests(channel,message_id,peer,incoming,state,created_at)"
" SELECT channel,message_id,123,0,1,0 FROM attachment_keys WHERE channel='%s'", f->channel);
sql(f->inst->topo_sqlite_db, query);
+5 -3
View File
@@ -564,9 +564,11 @@ static void test_completion_limit(void) {
}
static void channel_state(struct fixture* f, int deleted) {
struct TOPO_GROUP* group = topo_groups_find(f->inst->topo_groups, strtoull(f->channel, NULL, 10));
assert(deleted ? !group : group && !group->stopping);
assert(deleted ? !si_find(f->inst, f->channel) : si_find(f->inst, f->channel) != NULL);
if (f->inst) {
struct TOPO_GROUP* group = topo_groups_find(f->inst->topo_groups, strtoull(f->channel, NULL, 10));
assert(deleted ? !group : group && !group->stopping);
assert(deleted ? !si_find(f->inst, f->channel) : si_find(f->inst, f->channel) != NULL);
}
sqlite3_stmt* st = NULL;
assert(sqlite3_prepare_v2(f->reader, "SELECT EXISTS(SELECT 1 FROM channels WHERE channel_id=?1),"
"EXISTS(SELECT 1 FROM attachment_keys WHERE channel=?1),EXISTS(SELECT 1 FROM attachment_key_requests WHERE channel=?1),"