Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Verify transaction against its block during import #10954

Merged
merged 4 commits into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ impl Miner {
let sender = transaction.sender();

// Re-verify transaction again vs current state.
let result = client.verify_signed(&transaction)
let result = client.verify_for_pending_block(&transaction, &open_block.header)
.map_err(|e| e.into())
.and_then(|_| {
open_block.push_transaction(transaction, None)
Expand Down
11 changes: 6 additions & 5 deletions ethcore/src/miner/pool_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ impl<'a, C: 'a> PoolClient<'a, C> where
}
}

/// Verifies if signed transaction is executable.
/// Verifies transaction against its block (before its import into this block)
/// Also Verifies if signed transaction is executable.
///
/// This should perform any verifications that rely on chain status.
pub fn verify_signed(&self, tx: &SignedTransaction) -> Result<(), transaction::Error> {
self.engine.machine().verify_transaction(&tx, &self.best_block_header, self.chain)
pub fn verify_for_pending_block(&self, tx: &SignedTransaction, header: &Header) -> Result<(), transaction::Error> {
self.engine.machine().verify_transaction_basic(tx, header)?;
self.engine.machine().verify_transaction(tx, &self.best_block_header, self.chain)
}
}

Expand All @@ -139,8 +141,7 @@ impl<'a, C: 'a> pool::client::Client for PoolClient<'a, C> where
self.engine.verify_transaction_basic(&tx, &self.best_block_header)?;
let tx = tx.verify_unordered()?;

self.verify_signed(&tx)?;

self.engine.machine().verify_transaction(&tx, &self.best_block_header, self.chain)?;
Ok(tx)
}

Expand Down