chaindb: minor.

This commit is contained in:
Christopher Jeffrey 2017-12-24 02:24:56 -08:00
parent d5a2609f75
commit c63e977ccf
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 14 additions and 11 deletions

View File

@ -881,7 +881,7 @@ class ChainDB {
* @returns {Promise}
*/
getHashes(start = -1, end = -1) {
async getHashes(start = -1, end = -1) {
if (start === -1)
start = 0;
@ -903,7 +903,7 @@ class ChainDB {
* @returns {Promise} - Returns {@link ChainEntry}[].
*/
getEntries() {
async getEntries() {
return this.db.values({
gte: layout.e.min(),
lte: layout.e.max(),
@ -916,7 +916,7 @@ class ChainDB {
* @returns {Promise} - Returns {@link Hash}[].
*/
getTips() {
async getTips() {
return this.db.keys({
gte: layout.p.min(),
lte: layout.p.max(),
@ -1178,7 +1178,7 @@ class ChainDB {
gte: layout.C.min(hash),
lte: layout.C.max(hash),
parse: (key) => {
const [, txid, index] = layout.C.parse(hash);
const [, txid, index] = layout.C.parse(key);
return [txid, index];
}
});
@ -1212,8 +1212,8 @@ class ChainDB {
gte: layout.T.min(hash),
lte: layout.T.max(hash),
parse: (key) => {
const [, hash] = layout.T.parse(key);
hashes[hash] = true;
const [, txid] = layout.T.parse(key);
hashes[txid] = true;
}
});
}
@ -1251,15 +1251,15 @@ class ChainDB {
addrs = [addrs];
const hashes = await this.getHashesByAddress(addrs);
const txs = [];
const mtxs = [];
for (const hash of hashes) {
const tx = await this.getMeta(hash);
assert(tx);
txs.push(tx);
const mtx = await this.getMeta(hash);
assert(mtx);
mtxs.push(mtx);
}
return txs;
return mtxs;
}
/**
@ -2064,6 +2064,7 @@ class ChainFlags {
toRaw() {
const bw = bio.write(12);
let flags = 0;
if (this.spv)

View File

@ -15,6 +15,7 @@ let parent = null;
const db = bdb.create({
location: process.argv[2],
memory: false,
compression: true,
cacheSize: 32 << 20,
createIfMissing: false

View File

@ -30,6 +30,7 @@ assert(process.argv.length > 2, 'Please pass in a database path.');
const db = bdb.create({
location: process.argv[2],
memory: false,
compression: true,
cacheSize: 32 << 20,
createIfMissing: false