openethereum/ethcore/src/null_engine.rs

32 lines
734 B
Rust
Raw Normal View History

use engine::Engine;
use spec::Spec;
2016-01-11 16:28:30 +01:00
use evm::Schedule;
2016-01-14 17:24:57 +01:00
use evm::Factory;
use env_info::EnvInfo;
/// An engine which does not provide any consensus mechanism.
pub struct NullEngine {
spec: Spec,
2016-01-14 17:24:57 +01:00
factory: Factory
}
impl NullEngine {
2016-01-21 16:08:09 +01:00
/// Returns new instance of NullEngine with default VM Factory
pub fn new_boxed(spec: Spec) -> Box<Engine> {
2016-01-14 17:24:57 +01:00
Box::new(NullEngine{
spec: spec,
// TODO [todr] should this return any specific factory?
factory: Factory::default()
})
}
}
impl Engine for NullEngine {
2016-01-14 17:24:57 +01:00
fn vm_factory(&self) -> &Factory {
&self.factory
}
fn name(&self) -> &str { "NullEngine" }
fn spec(&self) -> &Spec { &self.spec }
2016-01-11 16:28:30 +01:00
fn schedule(&self, _env_info: &EnvInfo) -> Schedule { Schedule::new_frontier() }
}