db: do not use isBrowser for bufferKeys check. see #137.

This commit is contained in:
Christopher Jeffrey 2017-02-28 13:04:55 -08:00
parent 7bd89b35c3
commit 29fe6468eb
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
9 changed files with 11 additions and 3 deletions

View File

@ -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;

View File

@ -11,6 +11,7 @@ var pad8 = util.pad8;
var pad32 = util.pad32;
var layout = {
binary: false,
R: 'R',
O: 'O',
V: 'v',

View File

@ -28,6 +28,7 @@
*/
var layout = {
binary: true,
R: new Buffer([0x52]),
O: new Buffer([0x4f]),
V: new Buffer([0x76]),

View File

@ -7,6 +7,7 @@
'use strict';
var layout = {
binary: false,
R: 'R',
V: 'V',
e: function e(hash) {

View File

@ -14,6 +14,7 @@
*/
var layout = {
binary: true,
R: new Buffer([0x52]),
V: new Buffer([0x76]),
e: function e(hash) {

View File

@ -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;

View File

@ -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;
},

View File

@ -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;

View File

@ -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;