remove unused code, add config files

This commit is contained in:
Manuel Araoz 2015-04-27 12:53:49 -03:00
parent e99871fce9
commit d02cced4bd
7 changed files with 14 additions and 26 deletions

View File

@ -2,7 +2,15 @@ BitcoreHTTP:
port: 8080
logging: true
BitcoreNode:
LevelUp: ./testnet-db
network: testnet
NetworkMonitor:
network: livenet
host: localhost
port: 8333
port: 18333
Reporter: none # none, simple, matrix
RPC:
user: user
pass: password
protocol: http
host: 127.0.0.1
port: 18332

View File

@ -98,6 +98,7 @@ BitcoreHTTP.prototype.onListening = function() {
BitcoreHTTP.prototype.start = function() {
this.node.start();
this.server.listen(this.port);
};

View File

@ -5,9 +5,6 @@ BitcoreNode:
host: localhost
port: 8333
Reporter: none # none, simple, matrix
BitcoreHTTP:
host: localhost
port: 8080
RPC:
user: user
pass: password

View File

@ -5,9 +5,6 @@ BitcoreNode:
host: localhost
port: 8333
Reporter: none # none, simple, matrix
BitcoreHTTP:
host: localhost
port: 8080
RPC:
user: user
pass: password

View File

@ -5,9 +5,6 @@ BitcoreNode:
host: localhost
port: 18333
Reporter: none # none, simple, matrix
BitcoreHTTP:
host: localhost
port: 8080
RPC:
user: user
pass: password

View File

@ -73,7 +73,6 @@ NetworkMonitor.prototype.requestBlocks = function(locator) {
_.isString(locator[0]), 'start must be a block hash string array');
this.peer.sendMessage(this.messages.GetBlocks({
starts: locator,
//stop: '000000002c05cc2e78923c34df87fd108b22221ac6076c18f3ade378a4d915e9' // TODO: remove this!!!
}));
};

View File

@ -36,7 +36,6 @@ var BitcoreNode = function(bus, networkMonitor, blockService, transactionService
this.blockService = blockService;
this.blockCache = {};
this.inventory = {}; // blockHash -> bool (has data)
this.initialize();
};
util.inherits(BitcoreNode, EventEmitter);
@ -100,9 +99,8 @@ BitcoreNode.prototype.initialize = function() {
var prevHash = bitcore.util.buffer.reverse(block.header.prevHash).toString('hex');
self.blockCache[block.hash] = block;
self.inventory[block.hash] = true;
if (!self.blockchain.hasData(prevHash)) {
self.requestFromTip();
self._requestFromTip();
return;
}
var blockchainChanges = self.blockchain.proposeNewBlock(block);
@ -111,8 +109,6 @@ BitcoreNode.prototype.initialize = function() {
block.height = self.blockchain.height[block.id];
block.work = self.blockchain.work[block.id];
//console.log('block', block.id, block.height);
return Promise.each(blockchainChanges.unconfirmed, function(hash) {
return self.blockService.unconfirm(self.blockCache[hash]);
})
@ -128,13 +124,6 @@ BitcoreNode.prototype.initialize = function() {
delete self.blockCache[deleteHash];
}
})
.then(function() {
// TODO: include this
if (false && _.size(self.inventory) && _.all(_.values(self.inventory))) {
self.inventory = {};
self.requestFromTip();
}
})
.catch(function(error) {
self.stop(error);
});
@ -171,7 +160,7 @@ BitcoreNode.prototype.stop = function(reason) {
this.networkMonitor.abort(reason);
};
BitcoreNode.prototype.requestFromTip = function() {
BitcoreNode.prototype._requestFromTip = function() {
var locator = this.blockchain.getBlockLocator();
//console.log('requesting blocks, locator size:', locator.length);
this.networkMonitor.requestBlocks(locator);
@ -180,7 +169,7 @@ BitcoreNode.prototype.requestFromTip = function() {
BitcoreNode.prototype.sync = function() {
var self = this;
this.networkMonitor.on('ready', function() {
self.requestFromTip();
self._requestFromTip();
});
};