jsbeautify
This commit is contained in:
parent
ead58e1e52
commit
5576dacf69
@ -70,7 +70,7 @@ function spec() {
|
|||||||
var that = this;
|
var that = this;
|
||||||
var genesisHash = this.network.genesisBlock.hash.reverse().toString('hex');
|
var genesisHash = this.network.genesisBlock.hash.reverse().toString('hex');
|
||||||
|
|
||||||
console.log('Syncing Blocks... '+reindex);
|
console.log('Syncing Blocks... ' + reindex);
|
||||||
if (reindex) {
|
if (reindex) {
|
||||||
return this.getNextBlock(genesisHash, cb);
|
return this.getNextBlock(genesisHash, cb);
|
||||||
}
|
}
|
||||||
@ -202,7 +202,6 @@ function spec() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Sync.prototype.close = function() {
|
Sync.prototype.close = function() {
|
||||||
console.log("closing connection");
|
console.log("closing connection");
|
||||||
this.db.close();
|
this.db.close();
|
||||||
|
|||||||
8
p2p.js
8
p2p.js
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
@ -108,7 +107,7 @@ function handle_tx(info) {
|
|||||||
console.log('Handle tx: ' + tx.hash);
|
console.log('Handle tx: ' + tx.hash);
|
||||||
sync.storeTxs([tx.hash], function(err) {
|
sync.storeTxs([tx.hash], function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('error in handle TX: '+err);
|
console.log('error in handle TX: ' + err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -117,7 +116,7 @@ function handle_block(info) {
|
|||||||
var block = info.message.block;
|
var block = info.message.block;
|
||||||
var now = Math.round(new Date().getTime() / 1000);
|
var now = Math.round(new Date().getTime() / 1000);
|
||||||
var blockHash = coinUtil.formatHashFull(block.calcHash());
|
var blockHash = coinUtil.formatHashFull(block.calcHash());
|
||||||
console.log('Handle block: '+ blockHash);
|
console.log('Handle block: ' + blockHash);
|
||||||
sync.storeBlock({
|
sync.storeBlock({
|
||||||
'hash': blockHash,
|
'hash': blockHash,
|
||||||
'time': now
|
'time': now
|
||||||
@ -129,11 +128,10 @@ function handle_block(info) {
|
|||||||
var hashes = block.txs.map(function(tx) {
|
var hashes = block.txs.map(function(tx) {
|
||||||
return coinUtil.formatHashFull(tx.hash);
|
return coinUtil.formatHashFull(tx.hash);
|
||||||
});
|
});
|
||||||
sync.storeTxs(hashes, function(){});
|
sync.storeTxs(hashes, function() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_connected(data) {
|
function handle_connected(data) {
|
||||||
|
|||||||
@ -14,32 +14,12 @@ var
|
|||||||
|
|
||||||
mongoose.connection.on('error', function(err) { console.log(err); });
|
mongoose.connection.on('error', function(err) { console.log(err); });
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
describe('Block getInfo', function(){
|
|
||||||
=======
|
|
||||||
describe('Block fromHashWithInfo', function(){
|
describe('Block fromHashWithInfo', function(){
|
||||||
>>>>>>> fd86e6d074c5aa4642172b221b9e6f69f3fd8634
|
|
||||||
|
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
mongoose.connect(config.db);
|
mongoose.connect(config.db);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
after(function(done) {
|
|
||||||
mongoose.connection.close();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should poll block\'s info from mongoose', function(done) {
|
|
||||||
var block2 = Block.fromHashWithInfo(TESTING_BLOCK, function(err, b2) {
|
|
||||||
if (err) done(err);
|
|
||||||
|
|
||||||
assert.equal(b2.hash, TESTING_BLOCK);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
=======
|
|
||||||
|
|
||||||
after(function(done) {
|
after(function(done) {
|
||||||
mongoose.connection.close();
|
mongoose.connection.close();
|
||||||
@ -56,17 +36,11 @@ describe('Block fromHashWithInfo', function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
>>>>>>> fd86e6d074c5aa4642172b221b9e6f69f3fd8634
|
|
||||||
|
|
||||||
it('should poll block\'s info from bitcoind', function(done) {
|
it('should poll block\'s info from bitcoind', function(done) {
|
||||||
var block2 = Block.fromHashWithInfo(TESTING_BLOCK, function(err, b2) {
|
var block2 = Block.fromHashWithInfo(TESTING_BLOCK, function(err, b2) {
|
||||||
if (err) done(err);
|
if (err) done(err);
|
||||||
assert.equal(b2.info.hash, TESTING_BLOCK);
|
assert.equal(b2.info.hash, TESTING_BLOCK);
|
||||||
<<<<<<< HEAD
|
|
||||||
assert.equal(b2.info.chainwork, '00000000000000000000000000000000000000000000000000446af21d50acd3');
|
|
||||||
=======
|
|
||||||
assert.equal(b2.info.chainwork, '000000000000000000000000000000000000000000000000001b6dc969ffe847');
|
assert.equal(b2.info.chainwork, '000000000000000000000000000000000000000000000000001b6dc969ffe847');
|
||||||
>>>>>>> fd86e6d074c5aa4642172b221b9e6f69f3fd8634
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin / env node
|
# ! /usr/bin / env node
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -21,7 +21,6 @@ if (program.remove) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
function(cb) {
|
function(cb) {
|
||||||
sync.init(program);
|
sync.init(program);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user