diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index 17c47023..89807fee 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -2334,7 +2334,7 @@ function ChainOptions(options) { this.maxFiles = 64; this.cacheSize = 32 << 20; this.compression = true; - this.bufferKeys = !util.isBrowser; + this.bufferKeys = ChainDB.layout.binary; this.spv = false; this.prune = false; diff --git a/lib/blockchain/layout-browser.js b/lib/blockchain/layout-browser.js index b755428c..dae23c50 100644 --- a/lib/blockchain/layout-browser.js +++ b/lib/blockchain/layout-browser.js @@ -11,6 +11,7 @@ var pad8 = util.pad8; var pad32 = util.pad32; var layout = { + binary: false, R: 'R', O: 'O', V: 'v', diff --git a/lib/blockchain/layout.js b/lib/blockchain/layout.js index 0249882f..ede79632 100644 --- a/lib/blockchain/layout.js +++ b/lib/blockchain/layout.js @@ -28,6 +28,7 @@ */ var layout = { + binary: true, R: new Buffer([0x52]), O: new Buffer([0x4f]), V: new Buffer([0x76]), diff --git a/lib/mempool/layout-browser.js b/lib/mempool/layout-browser.js index cfd8df64..3ea916be 100644 --- a/lib/mempool/layout-browser.js +++ b/lib/mempool/layout-browser.js @@ -7,6 +7,7 @@ 'use strict'; var layout = { + binary: false, R: 'R', V: 'V', e: function e(hash) { diff --git a/lib/mempool/layout.js b/lib/mempool/layout.js index a540eb4e..558c06a2 100644 --- a/lib/mempool/layout.js +++ b/lib/mempool/layout.js @@ -14,6 +14,7 @@ */ var layout = { + binary: true, R: new Buffer([0x52]), V: new Buffer([0x76]), e: function e(hash) { diff --git a/lib/mempool/mempool.js b/lib/mempool/mempool.js index 548ef070..d72da233 100644 --- a/lib/mempool/mempool.js +++ b/lib/mempool/mempool.js @@ -1929,7 +1929,7 @@ function MempoolOptions(options) { this.maxFiles = 64; this.cacheSize = 32 << 20; this.compression = true; - this.bufferKeys = !util.isBrowser; + this.bufferKeys = layout.binary; this.persistent = false; diff --git a/lib/wallet/layout-browser.js b/lib/wallet/layout-browser.js index 463ed260..9693c1e7 100644 --- a/lib/wallet/layout-browser.js +++ b/lib/wallet/layout-browser.js @@ -11,6 +11,7 @@ var pad32 = util.pad32; var layouts = exports; layouts.walletdb = { + binary: false, p: function p(hash) { return 'p' + hash; }, @@ -72,6 +73,7 @@ layouts.walletdb = { }; layouts.txdb = { + binary: false, prefix: function prefix(wid, key) { return 't' + pad32(wid) + key; }, diff --git a/lib/wallet/layout.js b/lib/wallet/layout.js index d493f3ab..1c98838b 100644 --- a/lib/wallet/layout.js +++ b/lib/wallet/layout.js @@ -26,6 +26,7 @@ var layouts = exports; */ layouts.walletdb = { + binary: true, p: function p(hash) { var key = new Buffer(1 + (hash.length / 2)); key[0] = 0x70; @@ -149,6 +150,7 @@ layouts.walletdb = { */ layouts.txdb = { + binary: true, prefix: function prefix(wid, key) { var out = new Buffer(5 + key.length); out[0] = 0x74; diff --git a/lib/wallet/walletdb.js b/lib/wallet/walletdb.js index 3069cbc2..a66e392f 100644 --- a/lib/wallet/walletdb.js +++ b/lib/wallet/walletdb.js @@ -2166,7 +2166,7 @@ function WalletOptions(options) { this.maxFiles = 64; this.cacheSize = 16 << 20; this.compression = true; - this.bufferKeys = !util.isBrowser; + this.bufferKeys = layout.binary; this.spv = false; this.witness = false;