diff --git a/tools/chatgui/transport/merkle_sync.c b/tools/chatgui/transport/merkle_sync.c index 00af4c84..f4516d7d 100644 --- a/tools/chatgui/transport/merkle_sync.c +++ b/tools/chatgui/transport/merkle_sync.c @@ -169,7 +169,7 @@ static int _get_level_hashes(struct merkle_sync* ms, const char* ns, sqlite3* db = _db(ms->inst); if (!db) return -1; int parent_shift = 63 - (int)level * 5; if (parent_shift < 0) parent_shift = 0; int next_shift = 63 - ((int)level + 1) * 5; if (next_shift < 0) next_shift = 0; - uint64_t range_end = prefix | ((1ULL << parent_shift) - 1); + uint64_t range_end = prefix | (0x1FULL << parent_shift) | (0x1FULL << (next_shift > 0 ? next_shift : 0)); sqlite3_stmt* stmt = NULL; if (sqlite3_prepare_v2(db,