diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 9bc8b84039..b8d00b2056 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -162,7 +162,7 @@ namespace steemit { namespace app { int32_t block_num = int32_t(b.block_num()); if( _callbacks.size() ) { - for( int32_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num ) + for( size_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num ) { const auto& trx = b.transactions[trx_num]; auto id = trx.id(); @@ -170,7 +170,7 @@ namespace steemit { namespace app { if( itr == _callbacks.end() ) continue; confirmation_callback callback = itr->second; itr->second = [](variant){}; - callback( fc::variant(transaction_confirmation( id, block_num, trx_num, false )) ); + callback( fc::variant(transaction_confirmation( id, block_num, int32_t(trx_num), false )) ); } } @@ -193,53 +193,12 @@ namespace steemit { namespace app { transaction_id_type txid_byval = txid; // can't pass in by reference as it's going to be deleted callback( fc::variant(transaction_confirmation{ txid_byval, block_num, -1, true}) ); - //fc::async( [capture_this,block_num,txid_byval,callback](){ _callbacks.erase( cb_it ); } _callbacks_expirations.erase( exp_it ); } }); /// fc::async - /* - if( _callbacks.size() ) - { - for( int32_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num ) - { - const auto& trx = b.transactions[trx_num]; - auto id = trx.id(); - auto itr = _callbacks.find(id); - if( itr != _callbacks.end() ) - { - confirmation_callback callback = itr->second; - fc::async( [capture_this,id,block_num,trx_num,callback](){ callback( fc::variant(transaction_confirmation( id, block_num, trx_num, false )) ); } ); - _callbacks.erase( itr ); - } - } - } - /// clear all expirations - while( true ) - { - auto exp_it = _callbacks_expirations.begin(); - if( exp_it == _callbacks_expirations.end() ) - break; - if( exp_it->first >= b.timestamp ) - break; - for( const transaction_id_type& txid : exp_it->second ) - { - auto cb_it = _callbacks.find( txid ); - // If it's empty, that means the transaction has been confirmed and has been deleted by the above check. - if( cb_it == _callbacks.end() ) - continue; - std::shared_ptr< network_broadcast_api > capture_this = shared_from_this(); - confirmation_callback callback = cb_it->second; - transaction_id_type txid_byval = txid; // can't pass in by reference as it's going to be deleted - fc::async( [capture_this,block_num,txid_byval,callback](){ callback( fc::variant(transaction_confirmation{ txid_byval, block_num, -1, true}) ); } ); - _callbacks.erase( cb_it ); - } - _callbacks_expirations.erase( exp_it ); - } - */ - } void network_broadcast_api::broadcast_transaction(const signed_transaction& trx) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index b9dcc12163..90c4495b94 100755 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -1509,7 +1509,7 @@ vector database_api::get_discussions_by_author_before_date( #ifndef IS_LOW_MEM FC_ASSERT( limit <= 100 ); result.reserve( limit ); - int count = 0; + uint32_t count = 0; const auto& didx = my->_db.get_index().indices().get(); if( before_date == time_point_sec() ) diff --git a/libraries/chain/database.cpp b/libraries/chain/database.cpp index 8f22b963a0..1d81c68a48 100644 --- a/libraries/chain/database.cpp +++ b/libraries/chain/database.cpp @@ -1269,12 +1269,12 @@ void database::update_witness_schedule4() modify( wso, [&]( witness_schedule_object& _wso ) { // active witnesses has exactly STEEMIT_MAX_WITNESSES elements, asserted above - for( int i = 0; i < active_witnesses.size(); i++ ) + for( size_t i = 0; i < active_witnesses.size(); i++ ) { _wso.current_shuffled_witnesses[i] = active_witnesses[i]; } - for( int i = active_witnesses.size(); i < STEEMIT_MAX_WITNESSES; i++ ) + for( size_t i = active_witnesses.size(); i < STEEMIT_MAX_WITNESSES; i++ ) { _wso.current_shuffled_witnesses[i] = account_name_type(); } @@ -3126,7 +3126,7 @@ try { modify( get_feed_history(), [&]( feed_history_object& fho ) { fho.price_history.push_back( median_feed ); - int steemit_feed_history_window = STEEMIT_FEED_HISTORY_WINDOW_PRE_HF_16; + size_t steemit_feed_history_window = STEEMIT_FEED_HISTORY_WINDOW_PRE_HF_16; if( has_hardfork( STEEMIT_HARDFORK_0_16__551) ) steemit_feed_history_window = STEEMIT_FEED_HISTORY_WINDOW; @@ -3973,7 +3973,7 @@ void database::set_hardfork( uint32_t hardfork, bool apply_now ) { auto const& hardforks = get_hardfork_property_object(); - for( int i = hardforks.last_hardfork + 1; i <= hardfork && i <= STEEMIT_NUM_HARDFORKS; i++ ) + for( uint32_t i = hardforks.last_hardfork + 1; i <= hardfork && i <= STEEMIT_NUM_HARDFORKS; i++ ) { if( i <= STEEMIT_HARDFORK_0_5__54 ) _hardfork_times[i] = head_block_time(); diff --git a/libraries/net/node.cpp b/libraries/net/node.cpp index 836e57daf4..2538311810 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -2350,7 +2350,6 @@ namespace graphene { namespace net { namespace detail { { VERIFY_CORRECT_THREAD(); item_hash_t reference_point = peer->last_block_delegate_has_seen; - uint32_t reference_point_block_num = _delegate->get_block_number(peer->last_block_delegate_has_seen); // when we call _delegate->get_blockchain_synopsis(), we may yield and there's a // chance this peer's state will change before we get control back. Save off @@ -3366,7 +3365,7 @@ namespace graphene { namespace net { namespace detail { bool new_transaction_discovered = false; for (const item_hash_t& transaction_message_hash : contained_transaction_message_ids) { - size_t items_erased = _items_to_fetch.get().erase(item_id(trx_message_type, transaction_message_hash)); + _items_to_fetch.get().erase(item_id(trx_message_type, transaction_message_hash)); // there are two ways we could behave here: we could either act as if we received // the transaction outside the block and offer it to our peers, or we could just // forget about it (we would still advertise this block to our peers so they should diff --git a/libraries/plugins/debug_node/debug_node_plugin.cpp b/libraries/plugins/debug_node/debug_node_plugin.cpp index db095b4318..599b408f75 100644 --- a/libraries/plugins/debug_node/debug_node_plugin.cpp +++ b/libraries/plugins/debug_node/debug_node_plugin.cpp @@ -296,7 +296,6 @@ uint32_t debug_node_plugin::debug_generate_blocks( uint32_t new_slot = miss_blocks+1; std::string scheduled_witness_name = db.get_scheduled_witness( slot ); fc::time_point_sec scheduled_time = db.get_slot_time( slot ); - const chain::witness_object& scheduled_witness = db.get_witness( scheduled_witness_name ); steemit::chain::public_key_type scheduled_key = scheduled_witness.signing_key; if( debug_key != "" ) { diff --git a/libraries/plugins/follow/follow_evaluators.cpp b/libraries/plugins/follow/follow_evaluators.cpp index 3d350452bb..3deb6212c3 100644 --- a/libraries/plugins/follow/follow_evaluators.cpp +++ b/libraries/plugins/follow/follow_evaluators.cpp @@ -125,7 +125,6 @@ void reblog_evaluator::do_apply( const reblog_operation& o ) f.reblogs = 1; f.account_feed_id = next_id; }); - } else { diff --git a/libraries/plugins/market_history/market_history_api.cpp b/libraries/plugins/market_history/market_history_api.cpp index ba6a23b30a..29e7b3b0e6 100644 --- a/libraries/plugins/market_history/market_history_api.cpp +++ b/libraries/plugins/market_history/market_history_api.cpp @@ -62,20 +62,19 @@ market_volume market_history_api_impl::get_volume() const auto db = app.chain_database(); const auto& bucket_idx = db->get_index< bucket_index >().indices().get< by_bucket >(); auto itr = bucket_idx.lower_bound( boost::make_tuple( 0, db->head_block_time() - 86400 ) ); - uint32_t bucket_size; - market_volume result; - if( itr != bucket_idx.end() ) - bucket_size = itr->seconds; + if( itr == bucket_idx.end() ) + return result; - while( itr != bucket_idx.end() && itr->seconds == bucket_size ) + uint32_t bucket_size = itr->seconds; + do { result.steem_volume.amount += itr->steem_volume; result.sbd_volume.amount += itr->sbd_volume; ++itr; - } + } while( itr != bucket_idx.end() && itr->seconds == bucket_size ); return result; }