work towards testnet support

This commit is contained in:
Manuel Araoz 2015-04-16 20:27:38 -03:00
parent a0e80b2229
commit f2f5d7e807
3 changed files with 15 additions and 4 deletions

View File

@ -9,5 +9,14 @@ module.exports = {
'000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a6' +
'7962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b' +
'8d578a4c702b6bf11d5fac00000000', 'hex'),
testnet: new Buffer('')
}
testnet: new Buffer('010000000000000000000000000000000000000000000000000000000000' +
'0000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a5132' +
'3a9fb8aa4b1e5e4adae5494dffff001d1aa4ae1801010000000100000000' +
'00000000000000000000000000000000000000000000000000000000ffff' +
'ffff4d04ffff001d0104455468652054696d65732030332f4a616e2f3230' +
'3039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f' +
'6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01' +
'000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a6' +
'7962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b' +
'8d578a4c702b6bf11d5fac00000000', 'hex')
};

View File

@ -69,6 +69,7 @@ NetworkMonitor.prototype.requestBlocks = function(locator) {
$.checkArgument(_.isArray(locator) &&
_.isUndefined(locator[0]) ||
_.isString(locator[0]), 'start must be a block hash string array');
console.log('request blocks', locator);
this.peer.sendMessage(messages.GetBlocks({
starts: locator,
//stop: '000000002c05cc2e78923c34df87fd108b22221ac6076c18f3ade378a4d915e9' // TODO: remove this!!!

View File

@ -53,7 +53,7 @@ BitcoreNode.create = function(opts) {
);
var rpc = opts.rpc || Promise.promisifyAll(new RPC(opts.RPC));
var transactionService = opts.transactionService || new TransactionService({
var transactionService = opts.transactionService || new TransactionService({
rpc: rpc,
database: database
});
@ -75,6 +75,7 @@ BitcoreNode.create = function(opts) {
BitcoreNode.prototype.initialize = function() {
var self = this;
setInterval(function() {
if (!self.blockchain) {
// not ready yet
@ -99,6 +100,7 @@ BitcoreNode.prototype.initialize = function() {
// Annotate block with extra data from the chain
block.height = self.blockchain.height[block.id];
block.work = self.blockchain.work[block.id];
console.log('>block', block.id, 'height', block.height);
return Promise.each(blockchainChanges.unconfirmed, function(hash) {
return self.blockService.unconfirm(self.blockCache[hash]);
@ -144,7 +146,6 @@ BitcoreNode.prototype.start = function() {
this.blockService.getBlockchain().then(function(blockchain) {
if (!blockchain) {
console.log('nothing');
self.blockchain = new BlockChain();
self.bus.process(genesis);
} else {