Remove itertools dependency

This commit is contained in:
Roman Zeyde 2018-05-21 11:18:16 +03:00
parent c030f8739d
commit 5941edbbc6
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB
4 changed files with 8 additions and 14 deletions

View File

@ -12,7 +12,6 @@ bitcoin = "0.13"
crossbeam = "0.3.2"
error-chain = "0.11"
hex = "0.3"
itertools = "0.7.8"
log = "0.4"
pbr = "1.0.0"
rocksdb = "0.10.0"

View File

@ -6,7 +6,6 @@ extern crate bitcoin;
extern crate crossbeam;
extern crate crypto;
extern crate hex;
extern crate itertools;
extern crate pbr;
extern crate rocksdb;
extern crate serde;

View File

@ -4,7 +4,6 @@ use bitcoin::network::serialize::deserialize;
use bitcoin::util::hash::Sha256dHash;
use crypto::digest::Digest;
use crypto::sha2::Sha256;
use itertools::enumerate;
use std::collections::HashMap;
use std::sync::RwLock;
@ -155,7 +154,7 @@ impl<'a> Query<'a> {
));
let mut spending_inputs = Vec::new();
for t in &spending_txns {
for (index, input) in enumerate(&t.txn.input) {
for (index, input) in t.txn.input.iter().enumerate() {
if input.prev_hash == funding.txn_id
&& input.prev_index == funding.output_index as u32
{
@ -178,7 +177,7 @@ impl<'a> Query<'a> {
fn find_funding_outputs(&self, t: &TxnHeight, script_hash: &[u8]) -> Vec<FundingOutput> {
let mut result = Vec::new();
let txn_id = t.txn.txid();
for (index, output) in enumerate(&t.txn.output) {
for (index, output) in t.txn.output.iter().enumerate() {
if compute_script_hash(&output.script_pubkey[..]) == script_hash {
result.push(FundingOutput {
txn_id: txn_id,

View File

@ -4,7 +4,6 @@ use bitcoin::network::serialize::{deserialize, serialize};
use bitcoin::util::hash::Sha256dHash;
use crossbeam;
use hex;
use itertools;
use serde_json::{from_str, Number, Value};
use std::collections::HashMap;
use std::io::{BufRead, BufReader, Write};
@ -87,14 +86,12 @@ impl<'a> Connection<'a> {
let index = params.get(0).chain_err(|| "missing index")?;
let index = index.as_u64().chain_err(|| "non-number index")? as usize;
let heights: Vec<usize> = (0..CHUNK_SIZE).map(|h| index * CHUNK_SIZE + h).collect();
let headers = self.query.get_headers(&heights);
let result = itertools::join(
headers
.into_iter()
.map(|x| hex::encode(&serialize(&x).unwrap())),
"",
);
Ok(json!(result))
let headers: Vec<String> = self.query
.get_headers(&heights)
.into_iter()
.map(|x| hex::encode(&serialize(&x).unwrap()))
.collect();
Ok(json!(headers.join("")))
}
fn blockchain_block_get_header(&self, params: &[Value]) -> Result<Value> {