diff --git a/lib/bcoin/env.js b/lib/bcoin/env.js index eba6d24a..814c78f0 100644 --- a/lib/bcoin/env.js +++ b/lib/bcoin/env.js @@ -137,7 +137,7 @@ function Environment(options) { this.ec = require('./ec'); this.lru = require('./lru'); this.bloom = require('./bloom'); - this.bst = require('./bst'); + this.rbt = require('./rbt'); this.lowlevelup = require('./lowlevelup'); this.uri = require('./uri'); diff --git a/lib/bcoin/rbt.js b/lib/bcoin/rbt.js index d9ee63c7..364d09fb 100644 --- a/lib/bcoin/rbt.js +++ b/lib/bcoin/rbt.js @@ -545,8 +545,8 @@ RBT.prototype.range = function range(gte, lte) { while (!current.isNull()) { if (lte) { // Stop once we hit a key above our lte key. - cmp = this.compare(current.key, lte); - if (cmp > 0) + cmp = this.compare(lte, current.key); + if (cmp < 0) break; }