1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-23 14:50:45 +01:00

Revert "Use TryInto to convert slices into array"

This reverts commit 62592dbabf to support
Rust 1.32 on Debian.
This commit is contained in:
Roman Zeyde 2019-05-10 21:45:19 +03:00
parent 1aeba092ec
commit f8f53cebaf
No known key found for this signature in database
GPG key ID: 87CAE5FA46917CBB
5 changed files with 13 additions and 6 deletions

7
Cargo.lock generated
View file

@ -30,6 +30,11 @@ dependencies = [
"scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "arrayref"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "arrayvec"
version = "0.4.10"
@ -313,6 +318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "electrs"
version = "0.6.1"
dependencies = [
"arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitcoin 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1096,6 +1102,7 @@ dependencies = [
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841"
"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392"
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
"checksum ascii 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "97be891acc47ca214468e09425d02cef3af2c94d0d82081cd02061f996802f14"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"

View file

@ -12,6 +12,7 @@ readme = "README.md"
edition = "2018"
[dependencies]
arrayref = "0.3"
base64 = "0.10"
bincode = "1.0"
bitcoin = "0.18"

View file

@ -1,6 +1,6 @@
## Installation
Install [latest Rust](https://rustup.rs/) (1.34+),
Install [latest Rust](https://rustup.rs/) (1.33+),
[latest Bitcoin Core](https://bitcoincore.org/en/download/) (0.16+)
and [latest Electrum wallet](https://electrum.org/#download) (3.3+).

View file

@ -3,6 +3,8 @@
#[macro_use]
extern crate clap;
#[macro_use]
extern crate arrayref;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate log;

View file

@ -2,7 +2,6 @@ use bitcoin::blockdata::block::BlockHeader;
use bitcoin::util::hash::BitcoinHash;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use std::collections::HashMap;
use std::convert::TryInto;
use std::fmt;
use std::iter::FromIterator;
use std::slice;
@ -21,13 +20,11 @@ pub type FullHash = [u8; HASH_LEN];
pub type HashPrefix = [u8; HASH_PREFIX_LEN];
pub fn hash_prefix(hash: &[u8]) -> HashPrefix {
hash[..HASH_PREFIX_LEN]
.try_into()
.expect("failed to convert into HashPrefix")
*array_ref![hash, 0, HASH_PREFIX_LEN]
}
pub fn full_hash(hash: &[u8]) -> FullHash {
hash.try_into().expect("failed to convert into FullHash")
*array_ref![hash, 0, HASH_LEN]
}
#[derive(Eq, PartialEq, Clone)]