From 0d0a6b7c74d20ca2ea288a5fabcdaee8292168ec Mon Sep 17 00:00:00 2001 From: Sandip Patel Date: Mon, 19 Aug 2019 16:37:24 +0530 Subject: [PATCH] Fixed error while loading object database --- libraries/app/database_api.cpp | 4 ++-- libraries/db/include/graphene/db/index.hpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 8dd52e08..9aebc8f7 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -554,7 +554,7 @@ vector> database_api_impl::get_key_references( vectorsecond.size() ); + result.reserve( result.size() + itr->second.size() ); for( auto item : itr->second ) { wdump((a)(item)(item(_db).name)); @@ -565,7 +565,7 @@ vector> database_api_impl::get_key_references( vectorsecond.size() ); + result.reserve( result.size() + itr->second.size() ); for( auto item : itr->second ) result.push_back(item); } final_result.emplace_back( std::move(result) ); diff --git a/libraries/db/include/graphene/db/index.hpp b/libraries/db/include/graphene/db/index.hpp index aebdb8b9..15c0f94c 100644 --- a/libraries/db/include/graphene/db/index.hpp +++ b/libraries/db/include/graphene/db/index.hpp @@ -234,14 +234,12 @@ namespace graphene { namespace db { fc::raw::unpack(ds, _next_id); fc::raw::unpack(ds, open_ver); FC_ASSERT( open_ver == get_object_version(), "Incompatible Version, the serialization of objects in this index has changed" ); - try { - vector tmp; - while( true ) - { - fc::raw::unpack( ds, tmp ); - load( tmp ); - } - } catch ( const fc::exception& ){} + vector tmp; + while( ds.remaining() > 0 ) + { + fc::raw::unpack( ds, tmp ); + load( tmp ); + } } virtual void save( const path& db ) override