From 2f2e0f81ed7a83795cb81085062756077066d99e Mon Sep 17 00:00:00 2001 From: Christopher Berner Date: Mon, 21 Feb 2022 01:15:31 -0800 Subject: [PATCH] Update redb 0.0.5 (#160) --- Cargo.lock | 5 +++-- Cargo.toml | 2 +- src/index.rs | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6060824596..799a266196 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1152,8 +1152,9 @@ dependencies = [ [[package]] name = "redb" -version = "0.0.4" -source = "git+https://github.com/cberner/redb.git#8690d6bf17ca2798b3dc7ce2a07b8fb65f64496d" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49648fe45ea8e0205024fae151ac253398a05dd2cc1eebda32ac0d0e2674e7c1" dependencies = [ "libc", "memmap2", diff --git a/Cargo.toml b/Cargo.toml index 0c957ffd95..28aa43f480 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ integer-cbrt = "0.1.2" integer-sqrt = "0.1.5" jsonrpc = "0.12.1" log = "0.4.14" -redb = { version = "0.0.4", git = "https://github.com/cberner/redb.git" } +redb = "0.0.5" [dev-dependencies] criterion = "0.3.5" diff --git a/src/index.rs b/src/index.rs index 20f877e4e4..69d36738e2 100644 --- a/src/index.rs +++ b/src/index.rs @@ -58,7 +58,8 @@ impl Index { let height_to_hash = tx.open_table(&Self::HEIGHT_TO_HASH)?; let blocks_indexed = height_to_hash - .range_reversed(0..)? + .range(0..)? + .rev() .next() .map(|(height, _hash)| height + 1) .unwrap_or(0); @@ -103,7 +104,8 @@ impl Index { let mut height_to_hash = wtx.open_table(&Self::HEIGHT_TO_HASH)?; let height = height_to_hash - .range_reversed(0..)? + .range(0..)? + .rev() .next() .map(|(height, _hash)| height + 1) .unwrap_or(0); @@ -270,7 +272,7 @@ impl Index { Err(err) => return Err(err.into()), }; - match height_to_hash.range_reversed(0..)?.next() { + match height_to_hash.range(0..)?.rev().next() { Some((height, _hash)) if height >= ordinal.height().0 => {} _ => return Ok(None), } @@ -282,7 +284,8 @@ impl Index { }; match key_to_satpoint - .range_reversed([].as_slice()..=Key::new(ordinal).encode().as_slice())? + .range([].as_slice()..=Key::new(ordinal).encode().as_slice())? + .rev() .next() { Some((start_key, start_satpoint)) => {