fix tests. non-rolling bloom filter for txdb.
This commit is contained in:
parent
aec1ebbdd3
commit
48855ae56f
@ -62,8 +62,15 @@ function TXDB(db, options) {
|
|||||||
this.busy = false;
|
this.busy = false;
|
||||||
this.jobs = [];
|
this.jobs = [];
|
||||||
this.locker = new bcoin.locker(this);
|
this.locker = new bcoin.locker(this);
|
||||||
|
|
||||||
|
// Try to optimize for up to 1m addresses.
|
||||||
|
// We use a regular bloom filter here
|
||||||
|
// because we never want members to
|
||||||
|
// lose membership, even if quality
|
||||||
|
// degrades.
|
||||||
|
// Memory used: 1.7mb
|
||||||
this.filter = this.options.useFilter
|
this.filter = this.options.useFilter
|
||||||
? new bcoin.bloom.rolling(800000, 0.01)
|
? bcoin.bloom.fromRate(1000000, 0.001, -1)
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ var network = bcoin.network.get();
|
|||||||
var utils = bcoin.utils;
|
var utils = bcoin.utils;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var alertData = fs.readFileSync(__dirname + '/data/alertTests.raw');
|
var alertData = fs.readFileSync(__dirname + '/data/alertTests.raw');
|
||||||
|
var NetworkAddress = bcoin.packets.NetworkAddress;
|
||||||
|
|
||||||
describe('Protocol', function() {
|
describe('Protocol', function() {
|
||||||
var version = require('../package.json').version;
|
var version = require('../package.json').version;
|
||||||
@ -35,8 +36,8 @@ describe('Protocol', function() {
|
|||||||
version: constants.VERSION,
|
version: constants.VERSION,
|
||||||
services: constants.LOCAL_SERVICES,
|
services: constants.LOCAL_SERVICES,
|
||||||
ts: bcoin.now(),
|
ts: bcoin.now(),
|
||||||
remote: new bcoin.networkaddress(),
|
remote: new NetworkAddress(),
|
||||||
local: new bcoin.networkaddress(),
|
local: new NetworkAddress(),
|
||||||
nonce: utils.nonce(),
|
nonce: utils.nonce(),
|
||||||
agent: constants.USER_AGENT,
|
agent: constants.USER_AGENT,
|
||||||
height: 0,
|
height: 0,
|
||||||
@ -54,8 +55,8 @@ describe('Protocol', function() {
|
|||||||
version: constants.VERSION,
|
version: constants.VERSION,
|
||||||
services: constants.LOCAL_SERVICES,
|
services: constants.LOCAL_SERVICES,
|
||||||
ts: bcoin.now(),
|
ts: bcoin.now(),
|
||||||
remote: new bcoin.networkaddress(),
|
remote: new NetworkAddress(),
|
||||||
local: new bcoin.networkaddress(),
|
local: new NetworkAddress(),
|
||||||
nonce: utils.nonce(),
|
nonce: utils.nonce(),
|
||||||
agent: constants.USER_AGENT,
|
agent: constants.USER_AGENT,
|
||||||
height: 10,
|
height: 10,
|
||||||
@ -73,13 +74,13 @@ describe('Protocol', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var hosts = [
|
var hosts = [
|
||||||
new bcoin.networkaddress({
|
new NetworkAddress({
|
||||||
services: constants.LOCAL_SERVICES,
|
services: constants.LOCAL_SERVICES,
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 8333,
|
port: 8333,
|
||||||
ts: Date.now() / 1000 | 0
|
ts: Date.now() / 1000 | 0
|
||||||
}),
|
}),
|
||||||
new bcoin.networkaddress({
|
new NetworkAddress({
|
||||||
services: constants.LOCAL_SERVICES,
|
services: constants.LOCAL_SERVICES,
|
||||||
host: '::123:456:789a',
|
host: '::123:456:789a',
|
||||||
port: 18333,
|
port: 18333,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user