finished
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::sync::Arc;
|
||||
use hash::keccak;
|
||||
use util::*;
|
||||
use io::{IoHandler, IoContext, IoChannel};
|
||||
use ethcore::client::{BlockChainClient, Client};
|
||||
@@ -56,8 +57,8 @@ fn new_tx(secret: &Secret, nonce: U256, chain_id: u64) -> PendingTransaction {
|
||||
|
||||
#[test]
|
||||
fn authority_round() {
|
||||
let s0 = KeyPair::from_secret_slice(&"1".sha3()).unwrap();
|
||||
let s1 = KeyPair::from_secret_slice(&"0".sha3()).unwrap();
|
||||
let s0 = KeyPair::from_secret_slice(&keccak("1")).unwrap();
|
||||
let s1 = KeyPair::from_secret_slice(&keccak("0")).unwrap();
|
||||
let ap = Arc::new(AccountProvider::transient_provider());
|
||||
ap.insert_account(s0.secret().clone(), "").unwrap();
|
||||
ap.insert_account(s1.secret().clone(), "").unwrap();
|
||||
@@ -143,8 +144,8 @@ fn authority_round() {
|
||||
|
||||
#[test]
|
||||
fn tendermint() {
|
||||
let s0 = KeyPair::from_secret_slice(&"1".sha3()).unwrap();
|
||||
let s1 = KeyPair::from_secret_slice(&"0".sha3()).unwrap();
|
||||
let s0 = KeyPair::from_secret_slice(&keccak("1")).unwrap();
|
||||
let s1 = KeyPair::from_secret_slice(&keccak("0")).unwrap();
|
||||
let ap = Arc::new(AccountProvider::transient_provider());
|
||||
ap.insert_account(s0.secret().clone(), "").unwrap();
|
||||
ap.insert_account(s1.secret().clone(), "").unwrap();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use hash::keccak;
|
||||
use util::*;
|
||||
use ethcore::snapshot::{SnapshotService, ManifestData, RestorationStatus};
|
||||
use ethcore::header::BlockNumber;
|
||||
@@ -50,14 +51,14 @@ impl TestSnapshotService {
|
||||
let block_chunks: Vec<Bytes> = (0..num_block_chunks).map(|_| H256::random().to_vec()).collect();
|
||||
let manifest = ManifestData {
|
||||
version: 2,
|
||||
state_hashes: state_chunks.iter().map(|data| data.sha3()).collect(),
|
||||
block_hashes: block_chunks.iter().map(|data| data.sha3()).collect(),
|
||||
state_hashes: state_chunks.iter().map(|data| keccak(data)).collect(),
|
||||
block_hashes: block_chunks.iter().map(|data| keccak(data)).collect(),
|
||||
state_root: H256::new(),
|
||||
block_number: block_number,
|
||||
block_hash: block_hash,
|
||||
};
|
||||
let mut chunks: HashMap<H256, Bytes> = state_chunks.into_iter().map(|data| (data.sha3(), data)).collect();
|
||||
chunks.extend(block_chunks.into_iter().map(|data| (data.sha3(), data)));
|
||||
let mut chunks: HashMap<H256, Bytes> = state_chunks.into_iter().map(|data| (keccak(&data), data)).collect();
|
||||
chunks.extend(block_chunks.into_iter().map(|data| (keccak(&data), data)));
|
||||
TestSnapshotService {
|
||||
manifest: Some(manifest),
|
||||
chunks: chunks,
|
||||
|
||||
Reference in New Issue
Block a user