From 23983114553cf95d1889f91d70fde04c40235c31 Mon Sep 17 00:00:00 2001 From: keorn Date: Thu, 30 Mar 2017 14:01:19 -0400 Subject: [PATCH] add eip155 validation (#5346) --- ethcore/src/engines/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index f292a06d8..438b9bda0 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -39,7 +39,7 @@ use account_provider::AccountProvider; use block::ExecutedBlock; use builtin::Builtin; use env_info::EnvInfo; -use error::Error; +use error::{Error, TransactionError}; use spec::CommonParams; use evm::Schedule; use header::Header; @@ -157,6 +157,13 @@ pub trait Engine : Sync + Send { // TODO: consider including State in the params. fn verify_transaction_basic(&self, t: &UnverifiedTransaction, _header: &Header) -> Result<(), Error> { t.check_low_s()?; + + if let Some(n) = t.network_id() { + if n != self.params().chain_id { + return Err(TransactionError::InvalidNetworkId.into()); + } + } + Ok(()) }