From f7c91be622d1dd36d388c66d7b6d5ebbfcf3309f Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Fri, 9 Oct 2015 16:31:40 -0400 Subject: [PATCH] fix market history --- libraries/app/api.cpp | 2 ++ libraries/app/application.cpp | 2 -- libraries/db/object_database.cpp | 7 ++++--- .../graphene/market_history/market_history_plugin.hpp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 4ec4f5b8..1dfe94c1 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -346,7 +346,9 @@ namespace graphene { namespace app { while( itr != by_key_idx.end() && itr->key.open <= end && result.size() < 100 ) { if( !(itr->key.base == a && itr->key.quote == b && itr->key.seconds == bucket_seconds) ) + { return result; + } result.push_back(*itr); ++itr; } diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index d6d192ad..a3e01010 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -387,8 +387,6 @@ namespace detail { virtual bool handle_block(const graphene::net::block_message& blk_msg, bool sync_mode, std::vector& contained_transaction_message_ids) override { try { - if( !_chain_db->is_open() ) - return false; auto latency = graphene::time::now() - blk_msg.block.timestamp; if (!sync_mode || blk_msg.block.block_num() % 10000 == 0) diff --git a/libraries/db/object_database.cpp b/libraries/db/object_database.cpp index d7d81a25..e19db457 100644 --- a/libraries/db/object_database.cpp +++ b/libraries/db/object_database.cpp @@ -78,19 +78,20 @@ void object_database::flush() void object_database::wipe(const fc::path& data_dir) { close(); - ilog("Wiping object_database."); + ilog("Wiping object database..."); fc::remove_all(data_dir / "object_database"); - assert(!fc::exists(data_dir / "object_database")); + ilog("Done wiping object databse."); } void object_database::open(const fc::path& data_dir) { try { -// ilog("Open object_database in ${d}", ("d", data_dir)); + ilog("Opening object database from ${d} ...", ("d", data_dir)); _data_dir = data_dir; for( uint32_t space = 0; space < _index.size(); ++space ) for( uint32_t type = 0; type < _index[space].size(); ++type ) if( _index[space][type] ) _index[space][type]->open( _data_dir / "object_database" / fc::to_string(space)/fc::to_string(type) ); + ilog( "Done opening object database." ); } FC_CAPTURE_AND_RETHROW( (data_dir) ) } diff --git a/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp b/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp index 43639b25..cd53f9d5 100644 --- a/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp +++ b/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp @@ -52,7 +52,7 @@ struct bucket_key friend bool operator < ( const bucket_key& a, const bucket_key& b ) { - return std::tie( a.base, a.quote, b.seconds, a.open ) < std::tie( b.base, b.quote, b.seconds, b.open ); + return std::tie( a.base, a.quote, a.seconds, a.open ) < std::tie( b.base, b.quote, b.seconds, b.open ); } friend bool operator == ( const bucket_key& a, const bucket_key& b ) {