Fix getBlock and getTransaction benchmarks.
This commit is contained in:
parent
e7046c3115
commit
40c5ee53e5
|
@ -5,7 +5,7 @@ var bitcoin = require('bitcoin');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var maxTime = 20;
|
var maxTime = 20;
|
||||||
|
|
||||||
console.log('Benchmarking Bitcoind.js native interface versus Bitcoind JSON RPC interface');
|
console.log('Bitcoin Service native interface vs. Bitcoin JSON RPC interface');
|
||||||
console.log('----------------------------------------------------------------------');
|
console.log('----------------------------------------------------------------------');
|
||||||
|
|
||||||
// To run the benchmarks a fully synced Bitcore Core directory is needed. The RPC comands
|
// To run the benchmarks a fully synced Bitcore Core directory is needed. The RPC comands
|
||||||
|
@ -26,22 +26,29 @@ var fixtureData = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var bitcoind = require('../').daemon({
|
var bitcoind = require('../').services.Bitcoin({
|
||||||
datadir: process.env.BITCORENODE_DIR || '~/.bitcoin',
|
node: {
|
||||||
network: 'testnet'
|
datadir: process.env.HOME + '/.bitcoin',
|
||||||
|
network: {
|
||||||
|
name: 'testnet'
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bitcoind.on('error', function(err) {
|
bitcoind.on('error', function(err) {
|
||||||
bitcoind.log('error="%s"', err.message);
|
console.error(err.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
bitcoind.on('open', function(status) {
|
bitcoind.start(function(err) {
|
||||||
bitcoind.log('status="%s"', status);
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
console.log('Bitcoin Core started');
|
||||||
});
|
});
|
||||||
|
|
||||||
bitcoind.on('ready', function() {
|
bitcoind.on('ready', function() {
|
||||||
|
|
||||||
bitcoind.log('status="%s"', 'chaintip ready.');
|
console.log('Bitcoin Core ready');
|
||||||
|
|
||||||
var client = new bitcoin.Client({
|
var client = new bitcoin.Client({
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
|
@ -147,8 +154,16 @@ bitcoind.on('ready', function() {
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
], function(err) {
|
], function(err) {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
console.log('Finished');
|
console.log('Finished');
|
||||||
bitcoind.stop();
|
bitcoind.stop(function(err) {
|
||||||
process.exit();
|
if (err) {
|
||||||
|
console.error('Fail to stop services: ' + err);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue