EIP-98: Optional transaction state root (#4296)

* EIP98: Optional receipt state root

* Use if-else

* Fixing tests
This commit is contained in:
Arkadiy Paronyan
2017-01-25 20:22:48 +01:00
committed by Gav Wood
parent f5a4b55dae
commit c012dfc3ef
22 changed files with 99 additions and 42 deletions

View File

@@ -519,8 +519,13 @@ impl State {
// TODO uncomment once to_pod() works correctly.
// trace!("Applied transaction. Diff:\n{}\n", state_diff::diff_pod(&old, &self.to_pod()));
self.commit()?;
let receipt = Receipt::new(self.root().clone(), e.cumulative_gas_used, e.logs);
let state_root = if env_info.number < engine.params().eip98_transition {
self.commit()?;
Some(self.root().clone())
} else {
None
};
let receipt = Receipt::new(state_root, e.cumulative_gas_used, e.logs);
trace!(target: "state", "Transaction receipt: {:?}", receipt);
Ok(ApplyOutcome{receipt: receipt, trace: e.trace})
}