shorter constructor for externalities
This commit is contained in:
parent
88409e7dbb
commit
d1aadf456f
@ -229,7 +229,7 @@ impl<'a> Executive<'a> {
|
||||
}
|
||||
} else if params.code.len() > 0 {
|
||||
// if destination is a contract, do normal message call
|
||||
let mut ext = Externalities::new(self.state, self.info, self.engine, self.depth, params, substate, OutputPolicy::Return(output));
|
||||
let mut ext = Externalities::from_executive(self, params, substate, OutputPolicy::Return(output));
|
||||
let evm = VmFactory::create();
|
||||
evm.exec(¶ms, &mut ext)
|
||||
} else {
|
||||
@ -247,7 +247,7 @@ impl<'a> Executive<'a> {
|
||||
// then transfer value to it
|
||||
self.state.transfer_balance(¶ms.sender, ¶ms.address, ¶ms.value);
|
||||
|
||||
let mut ext = Externalities::new(self.state, self.info, self.engine, self.depth, params, substate, OutputPolicy::InitContract);
|
||||
let mut ext = Externalities::from_executive(self, params, substate, OutputPolicy::InitContract);
|
||||
let evm = VmFactory::create();
|
||||
evm.exec(¶ms, &mut ext)
|
||||
}
|
||||
@ -324,6 +324,11 @@ impl<'a> Externalities<'a> {
|
||||
output: output
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates `Externalities` from `Executive`.
|
||||
pub fn from_executive(e: &'a mut Executive, params: &'a EvmParams, substate: &'a mut Substate, output: OutputPolicy<'a>) -> Self {
|
||||
Self::new(e.state, e.info, e.engine, e.depth, params, substate, output)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Ext for Externalities<'a> {
|
||||
|
Loading…
Reference in New Issue
Block a user