Upgrade group avatar columns before notifying database readiness
This commit is contained in:
1 parent
5c772aeecf
commit
e8365fdec6
2 files changed
+9
No files matched your search
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "chat_core_priv.h"
|
||||
#include "group_avatar.h"
|
||||
#include "chat_event.h"
|
||||
#include "chat_setting.h"
|
||||
#include "chat_member.h"
|
||||
@@ -101,6 +102,10 @@ int chat_core_init(struct UTUN_INSTANCE* inst, const char* db_path) {
|
||||
sqlite3_exec(cc->db, "PRAGMA foreign_keys=ON", NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (group_avatar_schema_init(cc->db) < 0) {
|
||||
if (!cc->shared_db) sqlite3_close(cc->db);
|
||||
inst->chat_core = NULL; u_free(cc); return -1;
|
||||
}
|
||||
cc->inst = inst;
|
||||
cc->my_node_id = inst->node_id;
|
||||
|
||||
|
||||
@@ -119,6 +119,10 @@ int main(void) {
|
||||
group_x, NULL, group_public, NULL, signature));
|
||||
assert(!group_avatar_get(nodes[0], GROUP, ©) && copy.version == first.version);
|
||||
uint8_t private_key[32]; assert(!topo_node_sqlite_channel_get_priv(nodes[0]->topo_sqlite_db, CHANNEL, private_key));
|
||||
uint8_t wrong_pub[32] = {1};
|
||||
assert(topo_node_sqlite_channel_put(nodes[0]->topo_sqlite_db, CHANNEL, "avatar", nodes[0]->node_id,
|
||||
group_x, NULL, wrong_pub, NULL, signature) < 0);
|
||||
assert(!group_avatar_get(nodes[0], GROUP, ©) && copy.version == first.version);
|
||||
|
||||
etcp_router_set_receive_ready(nodes[1], ETCP_RT_ID_GROUP_AVATAR, hold);
|
||||
image[0] ^= 1; assert(!group_avatar_set(nodes[0], GROUP, image, 4097));
|
||||
|
||||
Reference in new issue
Block a user