Skip to content

Commit

Permalink
Update redb 0.0.5 (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner authored Feb 21, 2022
1 parent b95b007 commit 2f2e0f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 7 additions & 4 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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),
}
Expand All @@ -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)) => {
Expand Down

0 comments on commit 2f2e0f8

Please sign in to comment.