moved common code to helpers
This commit is contained in:
		
							parent
							
								
									d9e8a59cd2
								
							
						
					
					
						commit
						53c2cbc631
					
				| @ -44,6 +44,21 @@ pub fn create_test_block(header: &Header) -> Bytes { | ||||
| 	rlp.out() | ||||
| } | ||||
| 
 | ||||
| pub fn create_test_block_with_data(header: &Header, transactions: &[&Transaction], uncles: &[Header]) -> Bytes { | ||||
| 	let mut rlp = RlpStream::new_list(3); | ||||
| 	rlp.append(header); | ||||
| 	rlp.append_list(transactions.len()); | ||||
| 	for t in transactions { | ||||
| 		rlp.append_raw(&t.rlp_bytes_opt(Seal::With), 1); | ||||
| 	} | ||||
| 	rlp.append_list(uncles.len()); | ||||
| 	for h in uncles { | ||||
| 		rlp.append(h); | ||||
| 	} | ||||
| 	rlp.out() | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| pub fn generate_dummy_client(block_number: usize) -> Arc<Client> { | ||||
| 	let dir = RandomTempPath::new(); | ||||
| 
 | ||||
|  | ||||
| @ -221,28 +221,7 @@ mod tests { | ||||
| 	use spec::*; | ||||
| 	use transaction::*; | ||||
| 	use basic_types::*; | ||||
| 
 | ||||
| 	fn create_test_block(header: &Header) -> Bytes { | ||||
| 		let mut rlp = RlpStream::new_list(3); | ||||
| 		rlp.append(header); | ||||
| 		rlp.append_raw(&rlp::EMPTY_LIST_RLP, 1); | ||||
| 		rlp.append_raw(&rlp::EMPTY_LIST_RLP, 1); | ||||
| 		rlp.out() | ||||
| 	} | ||||
| 
 | ||||
| 	fn create_test_block_with_data(header: &Header, transactions: &[&Transaction], uncles: &[Header]) -> Bytes { | ||||
| 		let mut rlp = RlpStream::new_list(3); | ||||
| 		rlp.append(header); | ||||
| 		rlp.append_list(transactions.len()); | ||||
| 		for t in transactions { | ||||
| 			rlp.append_raw(&t.rlp_bytes_opt(Seal::With), 1); | ||||
| 		} | ||||
| 		rlp.append_list(uncles.len()); | ||||
| 		for h in uncles { | ||||
| 			rlp.append(h); | ||||
| 		} | ||||
| 		rlp.out() | ||||
| 	} | ||||
| 	use tests::helpers::*; | ||||
| 
 | ||||
| 	fn check_ok(result: Result<(), Error>) { | ||||
| 		result.unwrap_or_else(|e| panic!("Block verification failed: {:?}", e)); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user