diff --git a/lib/blockchain/chaindb.js b/lib/blockchain/chaindb.js index 973bc5b6..da1139de 100644 --- a/lib/blockchain/chaindb.js +++ b/lib/blockchain/chaindb.js @@ -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) diff --git a/migrate/chaindb3to4.js b/migrate/chaindb3to4.js index 3712a672..d5085ab0 100644 --- a/migrate/chaindb3to4.js +++ b/migrate/chaindb3to4.js @@ -15,6 +15,7 @@ let parent = null; const db = bdb.create({ location: process.argv[2], + memory: false, compression: true, cacheSize: 32 << 20, createIfMissing: false diff --git a/migrate/walletdb6to7.js b/migrate/walletdb6to7.js index 2c19b3fd..c2a80cae 100644 --- a/migrate/walletdb6to7.js +++ b/migrate/walletdb6to7.js @@ -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