Bind deferred-author integrity fixture to its signed author
This commit is contained in:
1 parent
65cdb5b468
commit
d0ff7a81f7
1 file changed
+9
-1
@@ -313,7 +313,15 @@ static void test_page_rollback(void) {
|
||||
static void test_late_author_key(void) {
|
||||
struct fixture f; init(&f); uint8_t sig[64]; sign(&f, 100, "waiting key", sig);
|
||||
assert(insert(&f, 100, "waiting key", sig) == 0);
|
||||
sql(&f, "UPDATE history SET node_id=99");
|
||||
uint8_t key[32];
|
||||
assert(db_sync_sign_message(10, 100, 99, &f.revision, "waiting key", 11, f.seed, sig) == 0);
|
||||
assert(chat_message_id(10, 100, 99, f.revision.nonce, key) == 0);
|
||||
sqlite3_stmt* replace = NULL;
|
||||
assert(sqlite3_prepare_v2(f.db.db, "UPDATE history SET node_id=99,author_signature=?,message_id=?,bucket=?", -1, &replace, NULL) == SQLITE_OK);
|
||||
assert(sqlite3_bind_blob(replace, 1, sig, 64, SQLITE_STATIC) == SQLITE_OK);
|
||||
assert(sqlite3_bind_blob(replace, 2, key, 32, SQLITE_STATIC) == SQLITE_OK);
|
||||
assert(sqlite3_bind_int64(replace, 3, (sqlite3_int64)(db_read64(key) >> 39)) == SQLITE_OK);
|
||||
assert(sqlite3_step(replace) == SQLITE_DONE && sqlite3_finalize(replace) == SQLITE_OK);
|
||||
assert(db_sync_verify(f.si) == 1 && f.si->index.pending && f.si->index.waiting_key && db_sync_count(f.si) == 1);
|
||||
sqlite3_stmt* st = NULL;
|
||||
assert(sqlite3_prepare_v2(f.db.db, "INSERT INTO nodes VALUES(99,?,1)", -1, &st, NULL) == SQLITE_OK);
|
||||
|
||||
Reference in new issue
Block a user