@@ -3949,25 +3949,11 @@ namespace eosio {
3949
3949
void connection::handle_message ( const block_id_type& id, signed_block_ptr ptr ) {
3950
3950
// post to dispatcher strand so that we don't have multiple threads validating the block header
3951
3951
peer_dlog (this , " posting block ${n} to dispatcher strand" , (" n" , ptr->block_num ()));
3952
- my_impl->dispatcher .strand .post ([id, c{shared_from_this ()}, ptr{std::move (ptr)}, cid=connection_id]() mutable {
3952
+ my_impl->dispatcher .strand .dispatch ([id, c{shared_from_this ()}, ptr{std::move (ptr)}, cid=connection_id]() mutable {
3953
3953
if (app ().is_quiting ()) // large sync span can have many of these queued up, exit quickly
3954
3954
return ;
3955
3955
controller& cc = my_impl->chain_plug ->chain ();
3956
3956
3957
- auto fork_db_root_num = my_impl->get_fork_db_root_num ();
3958
-
3959
- // may have come in on a different connection and posted into dispatcher strand before this one
3960
- if ( block_header::num_from_id (id) <= fork_db_root_num || my_impl->dispatcher .have_block ( id ) || cc.block_exists ( id ) ) { // thread-safe
3961
- boost::asio::post (c->strand , [c, id, ptr{std::move (ptr)}]() {
3962
- if (my_impl->dispatcher .add_peer_block ( id, c->connection_id )) {
3963
- c->send_block_nack (id);
3964
- }
3965
- const fc::microseconds age (fc::time_point::now () - ptr->timestamp );
3966
- my_impl->sync_master ->sync_recv_block ( c, id, block_header::num_from_id (id), age );
3967
- });
3968
- return ;
3969
- }
3970
-
3971
3957
// proper_svnn_block_seen is for integration tests that verify low number of `unlinkable_blocks` logs.
3972
3958
// Because we now process blocks immediately into the fork database, during savanna transition the first proper
3973
3959
// savanna block will be reported as unlinkable when lib syncing. We will request that block again and by then
@@ -3989,7 +3975,7 @@ namespace eosio {
3989
3975
controller::accepted_block_result abh = cc.accept_block ( id, ptr );
3990
3976
fork_db_add_result = abh.add_result ;
3991
3977
obh = std::move (abh.block );
3992
- unlinkable = !obh ;
3978
+ unlinkable = fork_db_add_result == fork_db_add_t ::failure ;
3993
3979
close_mode = sync_manager::closing_mode::handshake;
3994
3980
} catch ( const invalid_qc_claim& ex) {
3995
3981
exception = true ;
@@ -4028,11 +4014,9 @@ namespace eosio {
4028
4014
c->block_status_monitor_ .accepted ();
4029
4015
4030
4016
if (my_impl->chain_plug ->chain ().get_read_mode () == db_read_mode::IRREVERSIBLE) {
4031
- // non-irreversible notifies sync_manager when block is applied
4032
- my_impl->dispatcher .strand .post ([sync_master = my_impl->sync_master .get (), bh=*obh]() {
4033
- const fc::microseconds age (fc::time_point::now () - bh.timestamp ());
4034
- sync_master->sync_recv_block (connection_ptr{}, bh.id (), bh.block_num (), age);
4035
- });
4017
+ // non-irreversible notifies sync_manager when block is applied, call on dispatcher strand
4018
+ const fc::microseconds age (fc::time_point::now () - obh->timestamp ());
4019
+ my_impl->sync_master ->sync_recv_block (connection_ptr{}, obh->id (), obh->block_num (), age);
4036
4020
}
4037
4021
4038
4022
if (fork_db_add_result == fork_db_add_t ::appended_to_head || fork_db_add_result == fork_db_add_t ::fork_switch) {
0 commit comments