Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
on_accepted_block_header and on_accepted_block merged into one handler
Browse files Browse the repository at this point in the history
  • Loading branch information
moskvanaft committed Jul 10, 2018
1 parent 8d5dda5 commit 8268af2
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions plugins/bnet_plugin/bnet_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,7 @@ namespace eosio {
_block_header_notices.insert(s->id);
}
}
}

void on_accepted_block( const block_state_ptr& s ) {
verify_strand_in_this_thread(_strand, __func__, __LINE__);
//idump((_block_status.size())(_transaction_status.size()));
auto id = s->id;
//ilog( "accepted block ${n}", ("n",s->block_num) );
Expand Down Expand Up @@ -1214,18 +1211,6 @@ namespace eosio {
for_each_session( [s]( auto ses ){ ses->on_new_lib( s ); } );
}

/**
* Notify all active connections of the new accepted block so
* they can relay it. This method also pre-packages the block
* as a packed bnet_message so the connections can simply relay
* it on.
*/
void on_accepted_block( block_state_ptr s ) {
_ioc->post( [s,this] { /// post this to the thread pool because packing can be intensive
for_each_session( [s]( auto ses ){ ses->on_accepted_block( s ); } );
});
}

void on_accepted_block_header( block_state_ptr s ) {
_ioc->post( [s,this] { /// post this to the thread pool because packing can be intensive
for_each_session( [s]( auto ses ){ ses->on_accepted_block_header( s ); } );
Expand Down Expand Up @@ -1359,9 +1344,6 @@ namespace eosio {

wlog( "bnet startup " );

auto& chain = app().get_plugin<chain_plugin>().chain();
FC_ASSERT ( chain.get_read_mode() != chain::db_read_mode::IRREVERSIBLE, "bnet is not compatible with \"irreversible\" read_mode");

my->_on_appled_trx_handle = app().get_channel<channels::accepted_transaction>()
.subscribe( [this]( transaction_metadata_ptr t ){
my->on_accepted_transaction(t);
Expand All @@ -1372,11 +1354,6 @@ namespace eosio {
my->on_irreversible_block(s);
});

my->_on_accepted_block_handle = app().get_channel<channels::accepted_block>()
.subscribe( [this]( block_state_ptr s ){
my->on_accepted_block(s);
});

my->_on_accepted_block_header_handle = app().get_channel<channels::accepted_block_header>()
.subscribe( [this]( block_state_ptr s ){
my->on_accepted_block_header(s);
Expand Down

0 comments on commit 8268af2

Please sign in to comment.