commit
52cc91e1d7
@ -86,6 +86,9 @@ Node.prototype._loadBitcoinConf = function(config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.checkState((this.bitcoinConfiguration.txindex && this.bitcoinConfiguration.txindex == 1),
|
||||||
|
'Txindex option is required in order to use most of the features of bitcore-node. \
|
||||||
|
Please add "txindex=1" to your configuration and reindex an existing database if necessary with reindex=1');
|
||||||
};
|
};
|
||||||
|
|
||||||
Node.prototype._loadBitcoind = function(config) {
|
Node.prototype._loadBitcoind = function(config) {
|
||||||
|
|||||||
16
test/data/badbitcoin.conf
Normal file
16
test/data/badbitcoin.conf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#testnet=1
|
||||||
|
#irc=0
|
||||||
|
#upnp=0
|
||||||
|
server=1
|
||||||
|
|
||||||
|
whitelist=127.0.0.1
|
||||||
|
|
||||||
|
# listen on different ports
|
||||||
|
port=20000
|
||||||
|
|
||||||
|
rpcallowip=127.0.0.1
|
||||||
|
|
||||||
|
rpcuser=bitcoin
|
||||||
|
rpcpassword=local321
|
||||||
|
|
||||||
|
|
||||||
@ -22,6 +22,13 @@ BaseNode.prototype._loadConfiguration = sinon.spy();
|
|||||||
BaseNode.prototype._initialize = sinon.spy();
|
BaseNode.prototype._initialize = sinon.spy();
|
||||||
chainlib.Node = BaseNode;
|
chainlib.Node = BaseNode;
|
||||||
|
|
||||||
|
var BadNode = proxyquire('../lib/node', {
|
||||||
|
chainlib: chainlib,
|
||||||
|
fs: {
|
||||||
|
readFileSync: sinon.stub().returns(fs.readFileSync(__dirname + '/data/badbitcoin.conf'))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var Node = proxyquire('../lib/node', {
|
var Node = proxyquire('../lib/node', {
|
||||||
chainlib: chainlib,
|
chainlib: chainlib,
|
||||||
fs: {
|
fs: {
|
||||||
@ -117,6 +124,12 @@ describe('Bitcoind Node', function() {
|
|||||||
node._loadBitcoind({datadir: './test', testnet: true});
|
node._loadBitcoind({datadir: './test', testnet: true});
|
||||||
should.exist(node.bitcoind);
|
should.exist(node.bitcoind);
|
||||||
});
|
});
|
||||||
|
it('should throw an exception if txindex isn\'t enabled in the configuration', function() {
|
||||||
|
var node = new BadNode({});
|
||||||
|
(function() {
|
||||||
|
node._loadBitcoinConf({datadir: './test'});
|
||||||
|
}).should.throw('Txindex option');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('#_syncBitcoindAncestor', function() {
|
describe('#_syncBitcoindAncestor', function() {
|
||||||
it('will find an ancestor 6 deep', function() {
|
it('will find an ancestor 6 deep', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user