potential fix for peer not disconnecting after invalid block

This commit is contained in:
Daniel Larimer 2015-09-21 08:46:55 -04:00
parent f7980f5252
commit 6b915054d2
3 changed files with 6 additions and 5 deletions

View file

@ -55,8 +55,6 @@ void account_statistics_object::process_fees(const account_object& a, database&
{
if( pending_fees > 0 || pending_vested_fees > 0 )
{
const auto& props = d.get_global_properties();
auto pay_out_fees = [&](const account_object& account, share_type core_fee_total, bool require_vesting)
{
// Check the referrer -- if he's no longer a member, pay to the lifetime referrer instead.

View file

@ -129,7 +129,7 @@ block_id_type block_database::fetch_block_id( uint32_t block_num )const
index_entry e;
auto index_pos = sizeof(e)*block_num;
_block_num_to_pos.seekg( 0, _block_num_to_pos.end );
if ( _block_num_to_pos.tellg() <= index_pos )
if ( _block_num_to_pos.tellg() <= int64_t(index_pos) )
FC_THROW_EXCEPTION(fc::key_not_found_exception, "Block number ${block_num} not contained in block database", ("block_num", block_num));
_block_num_to_pos.seekg( index_pos );

View file

@ -3323,10 +3323,13 @@ namespace graphene { namespace net { namespace detail {
disconnect_exception = e;
disconnect_reason = "You offered me a block that I have deemed to be invalid";
peers_to_disconnect.push_back( originating_peer->shared_from_this() );
/* This loop fails do disconnect the originating peer
for (const peer_connection_ptr& peer : _active_connections)
if (!peer->ids_of_items_to_get.empty() &&
peer->ids_of_items_to_get.front() == block_message_to_process.block_id)
if (!peer->ids_of_items_to_get.empty() && peer->ids_of_items_to_get.front() == block_message_to_process.block_id)
peers_to_disconnect.push_back(peer);
*/
}
for (const peer_connection_ptr& peer : peers_to_disconnect)
{