diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-14 22:56:51 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-15 01:21:37 +0000 |
commit | f9d820ada1fecccf3b524660d25256cf77845014 (patch) | |
tree | cd07d5026d0240de74c3512cccb09281870d4d3a /src/blockchain_db/lmdb/db_lmdb.cpp | |
parent | Merge pull request #5144 (diff) | |
download | monero-f9d820ada1fecccf3b524660d25256cf77845014.tar.xz |
Fix v3/v4 db conversion
Diffstat (limited to '')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 747d30cf8..963f55790 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -4434,6 +4434,9 @@ void BlockchainLMDB::migrate_3_4() result = mdb_cursor_open(txn, o_block_info, &c_old); if (result) throw0(DB_ERROR(lmdb_error("Failed to open a cursor for block_info: ", result).c_str())); + result = mdb_cursor_open(txn, m_blocks, &c_blocks); + if (result) + throw0(DB_ERROR(lmdb_error("Failed to open a cursor for blocks: ", result).c_str())); if (!i) { MDB_stat db_stat; result = mdb_stat(txn, m_block_info, &db_stats); @@ -4462,8 +4465,9 @@ void BlockchainLMDB::migrate_3_4() // get block major version to determine which rule is in place if (!past_long_term_weight) { - MDB_val kb, vb; - result = mdb_cursor_get(c_blocks, &k, &v, MDB_NEXT); + MDB_val_copy<uint64_t> kb(bi.bi_height); + MDB_val vb; + result = mdb_cursor_get(c_blocks, &kb, &vb, MDB_SET); if (result) throw0(DB_ERROR(lmdb_error("Failed to query m_blocks: ", result).c_str())); if (vb.mv_size == 0) |