message: Added flag to temporarily behave like the validation mode is set to light when a block is produced by a trusted producer. GH
diff: @@ -1018,14 +1018,20 @@ struct controller_impl {
  void push_block( const signed_block_ptr& b, controller::block_status s ) {
  - // idump((fc::json::to_pretty_string(*b)));
  EOS_ASSERT(!pending, block_validate_exception, "it is not valid to push a block when there is a pending block");
  +
  + auto reset_prod_light_validation = fc::make_scoped_exit([this]() {
  + conf.trusted_producer_light_validation = false;
  + });
  try {
  EOS_ASSERT( b, block_validate_exception, "trying to push empty block" );
  EOS_ASSERT( s != controller::block_status::incomplete, block_validate_exception, "invalid block status for a completed block" );
  emit( self.pre_accepted_block, b );
  bool trust = !conf.force_all_checks && (s == controller::block_status::irreversible || s == controller::block_status::validated);
  auto new_header_state = fork_db.add( b, trust );
  + if (conf.trusted_producers.count(b->producer)) {
  + conf.trusted_producer_light_validation = true;
  + };
  emit( self.accepted_block_header, new_header_state );
  // on replay irreversible is not emitted by fork database, so emit it explicitly here
  if( s == controller::block_status::irreversible )
  @@ -1657,13 +1663,14 @@ bool controller::light_validation_allowed(bool replay_opts_disabled_by_policy) c
  return false;
  }
  - auto pb_status = my->pending->_block_status;
  + const auto pb_status = my->pending->_block_status;
  // in a pending irreversible or previously validated block and we have forcing all checks
  - bool consider_skipping_on_replay = (pb_status == block_status::irreversible || pb_status == block_status::validated) && !replay_opts_disabled_by_policy;
  + const bool consider_skipping_on_replay = (pb_status == block_status::irreversible || pb_status == block_status::validated) && !replay_opts_disabled_by_policy;
  // OR in a signed block and in light validation mode
  - bool consider_skipping_on_validate = (pb_status == block_status::complete && my->conf.block_validation_mode == validation_mode::LIGHT);
  + const bool consider_skipping_on_validate = (pb_status == block_status::complete &&
  + (my->conf.block_validation_mode == validation_mode::LIGHT || my->conf.trusted_producer_light_validation));
  return consider_skipping_on_replay || consider_skipping_on_validate;
  }
  