From 113df586220083d677f18f365ad5f70e9c6cd412 Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Thu, 7 Feb 2019 16:10:53 -0500 Subject: [PATCH] make all ops Eq; fix test imports --- src/chainstate/burn/operations/leader_block_commit.rs | 4 ++-- src/chainstate/burn/operations/leader_key_register.rs | 8 ++++---- src/chainstate/burn/operations/user_burn_support.rs | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/chainstate/burn/operations/leader_block_commit.rs b/src/chainstate/burn/operations/leader_block_commit.rs index 15d5db4f9..fbe9fa232 100644 --- a/src/chainstate/burn/operations/leader_block_commit.rs +++ b/src/chainstate/burn/operations/leader_block_commit.rs @@ -36,7 +36,7 @@ use util::hash::to_hex; pub const OPCODE: u8 = '[' as u8; -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq)] pub struct LeaderBlockCommitOp { pub block_header_hash: BlockHeaderHash, // hash of Stacks block header (double-sha256) pub new_seed: VRFSeed, // new seed for this block @@ -395,7 +395,7 @@ mod tests { } ]; - let parser = BitcoinBlockParser::new(BitcoinNetworkType::testnet, BLOCKSTACK_MAGIC_MAINNET); + let parser = BitcoinBlockParser::new(BitcoinNetworkType::Testnet, BLOCKSTACK_MAGIC_MAINNET); for tx_fixture in tx_fixtures { let tx = make_tx(&tx_fixture.txstr).unwrap(); diff --git a/src/chainstate/burn/operations/leader_key_register.rs b/src/chainstate/burn/operations/leader_key_register.rs index 2359c8c31..0720d74a5 100644 --- a/src/chainstate/burn/operations/leader_key_register.rs +++ b/src/chainstate/burn/operations/leader_key_register.rs @@ -40,7 +40,7 @@ use util::log; pub const OPCODE: u8 = '^' as u8; -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq)] pub struct LeaderKeyRegisterOp { pub consensus_hash: ConsensusHash, // consensus hash at time of issuance pub public_key: VRFPublicKey, // EdDSA public key @@ -234,7 +234,7 @@ mod tests { consensus_hash: ConsensusHash::from_bytes(&hex_bytes("2222222222222222222222222222222222222222").unwrap()).unwrap(), public_key: VRFPublicKey::from_bytes(&hex_bytes("a366b51292bef4edd64063d9145c617fec373bceb0758e98cd72becd84d54c7a").unwrap()).unwrap(), memo: vec![01, 02, 03, 04, 05], - address: BitcoinAddress::from_scriptpubkey(BitcoinNetworkType::testnet, &hex_bytes("76a9140be3e286a15ea85882761618e366586b5574100d88ac").unwrap()).unwrap(), + address: BitcoinAddress::from_scriptpubkey(BitcoinNetworkType::Testnet, &hex_bytes("76a9140be3e286a15ea85882761618e366586b5574100d88ac").unwrap()).unwrap(), op: OPCODE, txid: Txid::from_bytes_be(&hex_bytes("1bfa831b5fc56c858198acb8e77e5863c1e9d8ac26d49ddb914e24d8d4083562").unwrap()).unwrap(), @@ -251,7 +251,7 @@ mod tests { consensus_hash: ConsensusHash::from_bytes(&hex_bytes("2222222222222222222222222222222222222222").unwrap()).unwrap(), public_key: VRFPublicKey::from_bytes(&hex_bytes("a366b51292bef4edd64063d9145c617fec373bceb0758e98cd72becd84d54c7a").unwrap()).unwrap(), memo: vec![], - address: BitcoinAddress::from_scriptpubkey(BitcoinNetworkType::testnet, &hex_bytes("76a9140be3e286a15ea85882761618e366586b5574100d88ac").unwrap()).unwrap(), + address: BitcoinAddress::from_scriptpubkey(BitcoinNetworkType::Testnet, &hex_bytes("76a9140be3e286a15ea85882761618e366586b5574100d88ac").unwrap()).unwrap(), op: OPCODE, txid: Txid::from_bytes_be(&hex_bytes("2fbf8d5be32dce49790d203ba59acbb0929d5243413174ff5d26a5c6f23dea65").unwrap()).unwrap(), @@ -284,7 +284,7 @@ mod tests { } ]; - let parser = BitcoinBlockParser::new(BitcoinNetworkType::testnet, BLOCKSTACK_MAGIC_MAINNET); + let parser = BitcoinBlockParser::new(BitcoinNetworkType::Testnet, BLOCKSTACK_MAGIC_MAINNET); for tx_fixture in tx_fixtures { let tx = make_tx(&tx_fixture.txstr).unwrap(); diff --git a/src/chainstate/burn/operations/user_burn_support.rs b/src/chainstate/burn/operations/user_burn_support.rs index f53227143..c8aa9015c 100644 --- a/src/chainstate/burn/operations/user_burn_support.rs +++ b/src/chainstate/burn/operations/user_burn_support.rs @@ -39,7 +39,7 @@ use ed25519_dalek::PublicKey as VRFPublicKey; pub const OPCODE: u8 = '_' as u8; -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq)] pub struct UserBurnSupportOp { pub consensus_hash: ConsensusHash, pub public_key: VRFPublicKey, @@ -191,9 +191,11 @@ where mod tests { use super::*; use burnchains::bitcoin::blocks::BitcoinBlockParser; + use burnchains::bitcoin::BitcoinNetworkType; use burnchains::Txid; use burnchains::BLOCKSTACK_MAGIC_MAINNET; + use burnchains::bitcoin::keys::BitcoinPublicKey; use burnchains::bitcoin::address::BitcoinAddress; use bitcoin::network::serialize::deserialize; @@ -264,7 +266,7 @@ mod tests { } ]; - let parser = BitcoinBlockParser::new(BitcoinNetworkType::testnet, BLOCKSTACK_MAGIC_MAINNET); + let parser = BitcoinBlockParser::new(BitcoinNetworkType::Testnet, BLOCKSTACK_MAGIC_MAINNET); for tx_fixture in tx_fixtures { let tx = make_tx(&tx_fixture.txstr).unwrap();