Fixing self_convention errors
This commit is contained in:
parent
f169951d4e
commit
fc4b67a12d
@ -152,6 +152,7 @@ impl Engine for Ethash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(wrong_self_convention)] // to_ethash should take self
|
||||||
impl Ethash {
|
impl Ethash {
|
||||||
fn calculate_difficuty(&self, header: &Header, parent: &Header) -> U256 {
|
fn calculate_difficuty(&self, header: &Header, parent: &Header) -> U256 {
|
||||||
const EXP_DIFF_PERIOD: u64 = 100000;
|
const EXP_DIFF_PERIOD: u64 = 100000;
|
||||||
|
@ -75,7 +75,7 @@ impl<'a> Executive<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates `Externalities` from `Executive`.
|
/// Creates `Externalities` from `Executive`.
|
||||||
pub fn to_externalities<'_>(&'_ mut self, origin_info: OriginInfo, substate: &'_ mut Substate, output: OutputPolicy<'_>) -> Externalities {
|
pub fn as_externalities<'_>(&'_ mut self, origin_info: OriginInfo, substate: &'_ mut Substate, output: OutputPolicy<'_>) -> Externalities {
|
||||||
Externalities::new(self.state, self.info, self.engine, self.depth, origin_info, substate, output)
|
Externalities::new(self.state, self.info, self.engine, self.depth, origin_info, substate, output)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ impl<'a> Executive<'a> {
|
|||||||
let mut unconfirmed_substate = Substate::new();
|
let mut unconfirmed_substate = Substate::new();
|
||||||
|
|
||||||
let res = {
|
let res = {
|
||||||
let mut ext = self.to_externalities(OriginInfo::from(¶ms), &mut unconfirmed_substate, OutputPolicy::Return(output));
|
let mut ext = self.as_externalities(OriginInfo::from(¶ms), &mut unconfirmed_substate, OutputPolicy::Return(output));
|
||||||
self.engine.vm_factory().create().exec(params, &mut ext)
|
self.engine.vm_factory().create().exec(params, &mut ext)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ impl<'a> Executive<'a> {
|
|||||||
self.state.transfer_balance(¶ms.sender, ¶ms.address, ¶ms.value);
|
self.state.transfer_balance(¶ms.sender, ¶ms.address, ¶ms.value);
|
||||||
|
|
||||||
let res = {
|
let res = {
|
||||||
let mut ext = self.to_externalities(OriginInfo::from(¶ms), &mut unconfirmed_substate, OutputPolicy::InitContract);
|
let mut ext = self.as_externalities(OriginInfo::from(¶ms), &mut unconfirmed_substate, OutputPolicy::InitContract);
|
||||||
self.engine.vm_factory().create().exec(params, &mut ext)
|
self.engine.vm_factory().create().exec(params, &mut ext)
|
||||||
};
|
};
|
||||||
self.enact_result(&res, substate, unconfirmed_substate, backup);
|
self.enact_result(&res, substate, unconfirmed_substate, backup);
|
||||||
|
@ -93,10 +93,10 @@ pub struct Spec {
|
|||||||
state_root_memo: RwLock<Option<H256>>,
|
state_root_memo: RwLock<Option<H256>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(wrong_self_convention)] // because to_engine(self) should be to_engine(&self)
|
||||||
impl Spec {
|
impl Spec {
|
||||||
/// Convert this object into a boxed Engine of the right underlying type.
|
/// Convert this object into a boxed Engine of the right underlying type.
|
||||||
// TODO avoid this hard-coded nastiness - use dynamic-linked plugin framework instead.
|
// TODO avoid this hard-coded nastiness - use dynamic-linked plugin framework instead.
|
||||||
#[allow(wrong_self_convention)]
|
|
||||||
pub fn to_engine(self) -> Result<Box<Engine>, Error> {
|
pub fn to_engine(self) -> Result<Box<Engine>, Error> {
|
||||||
match self.engine_name.as_ref() {
|
match self.engine_name.as_ref() {
|
||||||
"NullEngine" => Ok(NullEngine::new_boxed(self)),
|
"NullEngine" => Ok(NullEngine::new_boxed(self)),
|
||||||
|
Loading…
Reference in New Issue
Block a user