eos icon indicating copy to clipboard operation
eos copied to clipboard

Where channels::pre_accepted_block was subscribed?

Open iamanopensourcer opened this issue 8 years ago • 2 comments

In controller_impl::push_block() method, send a signal called "pre_accepted_block", I found it was dealed with code below:

my->pre_accepted_block_connection = my->chain->pre_accepted_block.connect([this](const signed_block_ptr& blk) {
         auto itr = my->loaded_checkpoints.find( blk->block_num() );
         if( itr != my->loaded_checkpoints.end() ) {
            auto id = blk->id();
            EOS_ASSERT( itr->second == id, checkpoint_exception,
                        "Checkpoint does not match for block number ${num}: expected: ${expected} actual: ${actual}",
                        ("num", blk->block_num())("expected", itr->second)("actual", id)
            );
         }

         my->pre_accepted_block_channel.publish(blk);
      });

but I can't find out where channels::pre_accepted_block was subscribed.

Are these code useless?

iamanopensourcer avatar Oct 26 '18 07:10 iamanopensourcer

::connect creates a "subscription"

The signal is emitted here: https://github.com/EOSIO/eos/blob/f9a3d023c05d6b7984cbd7263a5a39e650c87e90/libraries/chain/controller.cpp#L1235

wanderingbort avatar Oct 26 '18 07:10 wanderingbort

my->pre_accepted_block_channel.publish(blk); I saw the code above,but I can't find code like this : app().get_channelchannels::pre_accepted_block().subscribe()

iamanopensourcer avatar Oct 26 '18 08:10 iamanopensourcer