diff --git a/ethcore/res/ethereum/classic.json b/ethcore/res/ethereum/classic.json index 223978ca489..c1879d4596b 100644 --- a/ethcore/res/ethereum/classic.json +++ b/ethcore/res/ethereum/classic.json @@ -27,6 +27,7 @@ "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", "networkID" : "0x1", + "chainID": "0x3d", "forkBlock": "0x1d4c00", "forkCanonHash": "0x94365e3a8c0b35089c1d1195081fe7489b528a84b22199c916180db8b28ade7f" }, diff --git a/ethcore/res/ethereum/morden.json b/ethcore/res/ethereum/morden.json index d2175625006..2adea0f8c9d 100644 --- a/ethcore/res/ethereum/morden.json +++ b/ethcore/res/ethereum/morden.json @@ -27,6 +27,7 @@ "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", "networkID" : "0x2", + "chainID": "0x3e", "forkBlock": "0x1b34d8", "forkCanonHash": "0xf376243aeff1f256d970714c3de9fd78fa4e63cf63e32a51fe1169e375d98145" }, diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index feb749e9e58..372ac053381 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -167,7 +167,7 @@ impl Engine for Ethash { fn signing_network_id(&self, env_info: &EnvInfo) -> Option { if env_info.number >= self.ethash_params.eip155_transition { - Some(self.params().network_id) + Some(self.params().chain_id) } else { None } @@ -316,7 +316,7 @@ impl Engine for Ethash { } if let Some(n) = t.network_id() { - if header.number() < self.ethash_params.eip155_transition || n != self.params().network_id { + if header.number() < self.ethash_params.eip155_transition || n != self.params().chain_id { return Err(TransactionError::InvalidNetworkId.into()) } } diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index bdcd5eee2d8..d3ba52b2edf 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -38,6 +38,8 @@ pub struct CommonParams { pub maximum_extra_data_size: usize, /// Network id. pub network_id: u64, + /// Chain id. + pub chain_id: u64, /// Main subprotocol name. pub subprotocol_name: String, /// Minimum gas limit. @@ -52,6 +54,7 @@ impl From for CommonParams { account_start_nonce: p.account_start_nonce.into(), maximum_extra_data_size: p.maximum_extra_data_size.into(), network_id: p.network_id.into(), + chain_id: if let Some(n) = p.chain_id { n.into() } else { p.network_id.into() }, subprotocol_name: p.subprotocol_name.unwrap_or_else(|| "eth".to_owned()), min_gas_limit: p.min_gas_limit.into(), fork_block: if let (Some(n), Some(h)) = (p.fork_block, p.fork_hash) { Some((n.into(), h.into())) } else { None }, diff --git a/json/src/spec/params.rs b/json/src/spec/params.rs index 88268631981..aeda7d1326c 100644 --- a/json/src/spec/params.rs +++ b/json/src/spec/params.rs @@ -35,6 +35,10 @@ pub struct Params { /// Network id. #[serde(rename="networkID")] pub network_id: Uint, + /// Chain id. + #[serde(rename="chainID")] + pub chain_id: Option, + /// Name of the main ("eth") subprotocol. #[serde(rename="subprotocolName")] pub subprotocol_name: Option, @@ -58,6 +62,7 @@ mod tests { "homesteadTransition": "0x118c30", "maximumExtraDataSize": "0x20", "networkID" : "0x1", + "chainID" : "0x15", "subprotocolName" : "exp", "minGasLimit": "0x1388", "accountStartNonce": "0x00"