Refactor pending_block to always return invalid txs and sometimes a block.

Docuemnt SealingWork properly.
This commit is contained in:
Gav Wood
2016-03-23 16:28:02 +00:00
parent 97449afbb9
commit 4e013ba2fc
7 changed files with 126 additions and 68 deletions

View File

@@ -261,6 +261,10 @@ impl<'x> OpenBlock<'x> {
///
/// If valid, it will be executed, and archived together with the receipt.
pub fn push_transaction(&mut self, t: SignedTransaction, h: Option<H256>) -> Result<&Receipt, Error> {
if self.block.transactions_set.contains(t.hash()) {
return Err(From::from(ExecutionError::AlreadyImported));
}
let env_info = self.env_info();
// info!("env_info says gas_used={}", env_info.gas_used);
match self.block.state.apply(&env_info, self.engine, &t, self.block.traces.is_some()) {