Skip to content

Commit 4c86254

Browse files
committed
deps: remove minimally useful byteorder crate
As its documentation details [1], the `u8` variant is only included for completeness becuase there is byteorder associated with reading a single byte. Instead of pulling in a dependency, inline the implementation of `read_u8()`.
1 parent f2dea36 commit 4c86254

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ edition = "2021"
1212
[dependencies]
1313
anyhow = "1.0.72"
1414
bitcoin = "0.30.1"
15-
byteorder = "1.4.3"
1615
clap = { version = "4.3.19", features = [ "cargo" ] }
1716
dirs = "5.0.1"
1817
hex = "0.4.3"

src/parser/index.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
use std::io::Read;
2+
13
use bitcoin::hashes::{sha256d, Hash};
24

3-
use byteorder::ReadBytesExt;
45
use rusty_leveldb::{LdbIterator, Options, DB};
56

67
use crate::ParserOptions;
@@ -153,7 +154,9 @@ fn is_block_index_record(data: &[u8]) -> bool {
153154
fn read_varint(reader: &mut std::io::Cursor<&[u8]>) -> anyhow::Result<u64> {
154155
let mut n = 0;
155156
loop {
156-
let ch_data = reader.read_u8()?;
157+
let mut buf = [0; 1];
158+
reader.read_exact(&mut buf)?;
159+
let ch_data = buf[0];
157160
assert!(n <= u64::MAX >> 7, "size too large");
158161
n = (n << 7) | u64::from(ch_data & 0x7F);
159162
if ch_data & 0x80 > 0 {

0 commit comments

Comments
 (0)