diff --git a/base_layer/core/src/consensus/consensus_constants.rs b/base_layer/core/src/consensus/consensus_constants.rs index 08f0eecd03..862b38aa06 100644 --- a/base_layer/core/src/consensus/consensus_constants.rs +++ b/base_layer/core/src/consensus/consensus_constants.rs @@ -507,11 +507,6 @@ impl ConsensusConstants { target_time: 200, }); let (input_version_range, output_version_range, kernel_version_range) = version_zero(); - let output_version_2_range = OutputVersionRange { - outputs: TransactionOutputVersion::V0..=TransactionOutputVersion::V0, - features: OutputFeaturesVersion::V0..=OutputFeaturesVersion::V0, - opcode: OpcodeVersion::V0..=OpcodeVersion::V1, - }; let consensus_constants_1 = ConsensusConstants { effective_from_height: 0, coinbase_lock_height: 6, @@ -534,29 +529,8 @@ impl ConsensusConstants { kernel_version_range, permitted_output_types: Self::current_permitted_output_types(), }; - let consensus_constants_2 = ConsensusConstants { - effective_from_height: 23000, - blockchain_version: 1, - valid_blockchain_version_range: 0..=1, - ..consensus_constants_1.clone() - }; - let consensus_constants_3 = ConsensusConstants { - effective_from_height: 25000, - output_version_range: output_version_2_range, - ..consensus_constants_2.clone() - }; - let consensus_constants_4 = ConsensusConstants { - effective_from_height: 33000, - blockchain_version: 2, - ..consensus_constants_3.clone() - }; - vec![ - consensus_constants_1, - consensus_constants_2, - consensus_constants_3, - consensus_constants_4, - ] + vec![consensus_constants_1] } pub fn mainnet() -> Vec { diff --git a/base_layer/core/src/proof_of_work/sha3_pow.rs b/base_layer/core/src/proof_of_work/sha3_pow.rs index 6d79061c38..6bb0308df8 100644 --- a/base_layer/core/src/proof_of_work/sha3_pow.rs +++ b/base_layer/core/src/proof_of_work/sha3_pow.rs @@ -34,26 +34,16 @@ use crate::{ /// Mining using this CPU version of the algorithm is unlikely to be profitable, but is included for reference and /// can be used to mine tXTR on testnets. pub fn sha3x_difficulty(header: &BlockHeader) -> Difficulty { - match header.version { - 2 => sha3x_difficulty_with_hash(header).0, - _ => old_sha3_difficulty_with_hash(header).0, - } + sha3x_difficulty_with_hash(header).0 } pub fn sha3_hash(header: &BlockHeader) -> Vec { - let sha = Sha3_256::new(); - match header.version { - 0 => sha - .chain(header.mining_hash()) - .chain(header.nonce.to_le_bytes()) - .chain(header.pow.to_bytes()), - _ => sha - .chain(header.nonce.to_le_bytes()) - .chain(header.mining_hash()) - .chain(header.pow.to_bytes()), - } - .finalize() - .to_vec() + Sha3_256::new() + .chain(header.nonce.to_le_bytes()) + .chain(header.mining_hash()) + .chain(header.pow.to_bytes()) + .finalize() + .to_vec() } fn sha3x_difficulty_with_hash(header: &BlockHeader) -> (Difficulty, Vec) { @@ -64,13 +54,6 @@ fn sha3x_difficulty_with_hash(header: &BlockHeader) -> (Difficulty, Vec) { (difficulty, hash.to_vec()) } -fn old_sha3_difficulty_with_hash(header: &BlockHeader) -> (Difficulty, Vec) { - let hash = sha3_hash(header); - let hash = Sha3_256::digest(&hash); - let difficulty = big_endian_difficulty(&hash); - (difficulty, hash.to_vec()) -} - #[cfg(test)] pub mod test { use chrono::{DateTime, NaiveDate, Utc}; diff --git a/base_layer/tari_mining_helper_ffi/src/lib.rs b/base_layer/tari_mining_helper_ffi/src/lib.rs index 67c2450918..f93c1ebad2 100644 --- a/base_layer/tari_mining_helper_ffi/src/lib.rs +++ b/base_layer/tari_mining_helper_ffi/src/lib.rs @@ -370,8 +370,8 @@ mod tests { #[test] fn detect_change_in_consensus_encoding() { - const NONCE: u64 = 1368783905506569398; - const DIFFICULTY: Difficulty = Difficulty::from_u64(3549); + const NONCE: u64 = 18006431465547767508; + const DIFFICULTY: Difficulty = Difficulty::from_u64(13879); unsafe { let mut error = -1; let error_ptr = &mut error as *mut c_int; diff --git a/infrastructure/tari_script/src/op_codes.rs b/infrastructure/tari_script/src/op_codes.rs index b862e1a41c..e946b69d9c 100644 --- a/infrastructure/tari_script/src/op_codes.rs +++ b/infrastructure/tari_script/src/op_codes.rs @@ -316,12 +316,12 @@ impl Opcode { Opcode::CheckSigVerify(..) | Opcode::CheckMultiSig(..) | Opcode::CheckMultiSigVerify(..) | + Opcode::CheckMultiSigVerifyAggregatePubKey(..) | Opcode::ToRistrettoPoint | Opcode::Return | Opcode::IfThen | Opcode::Else | Opcode::EndIf => OpcodeVersion::V0, - Opcode::CheckMultiSigVerifyAggregatePubKey(..) => OpcodeVersion::V1, } } @@ -636,7 +636,6 @@ impl fmt::Display for Opcode { #[repr(u8)] pub enum OpcodeVersion { V0 = 0, - V1 = 1, } #[cfg(test)]