fix jslint
This commit is contained in:
parent
8f9fdc1a6e
commit
751d6ce707
|
@ -9,12 +9,9 @@ var mongoose = require('mongoose'),
|
|||
util = require('bitcore/util/util'),
|
||||
BitcoreBlock= require('bitcore/Block').class(),
|
||||
Transaction = require('./Transaction'),
|
||||
async = require('async'),
|
||||
config = require('../../config/config')
|
||||
;
|
||||
|
||||
var CONCURRENCY = 5;
|
||||
|
||||
/**
|
||||
* Block Schema
|
||||
*/
|
||||
|
@ -47,16 +44,18 @@ BlockSchema.path('title').validate(function(title) {
|
|||
|
||||
BlockSchema.statics.createTimestamped = function(block, cb) {
|
||||
|
||||
var that = this;
|
||||
var That= this;
|
||||
var now = Math.round(new Date().getTime() / 1000);
|
||||
|
||||
var BlockSchema = mongoose.model('Block', BlockSchema);
|
||||
var newBlock = new that();
|
||||
var newBlock = new That();
|
||||
newBlock.time = now;
|
||||
|
||||
Transaction.createFromArray(block.tx, function(err, inserted_txs) {
|
||||
if (err) return cb(err);
|
||||
newBlock.save(cb);
|
||||
newBlock.save(function(err) {
|
||||
return cb(err, inserted_txs);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -96,17 +96,15 @@ TransactionSchema.statics.createFromArray = function(txs, next) {
|
|||
async.forEachLimit(txs, CONCURRENCY, function(txid, cb) {
|
||||
|
||||
that.explodeTransactionItems( txid, function(err) {
|
||||
if (err) return next(err);
|
||||
|
||||
that.create({txid: txid, time: now}, function(err, new_tx) {
|
||||
|
||||
//console.log("created:", err, new_tx);
|
||||
|
||||
if (err && ! err.toString().match(/E11000/)) return cb(err);
|
||||
|
||||
if (new_tx) mongo_txs.push(new_tx);
|
||||
return cb();
|
||||
});
|
||||
})
|
||||
});
|
||||
},
|
||||
function(err) {
|
||||
return next(err, mongo_txs);
|
||||
|
@ -117,8 +115,6 @@ TransactionSchema.statics.createFromArray = function(txs, next) {
|
|||
TransactionSchema.statics.explodeTransactionItems = function(txid, cb) {
|
||||
|
||||
this.queryInfo(txid, function(err, info) {
|
||||
|
||||
//console.log("INFO",info);
|
||||
if (err || !info) return cb(err);
|
||||
|
||||
var index = 0;
|
||||
|
@ -168,7 +164,8 @@ TransactionSchema.statics.explodeTransactionItems = function(txid, cb) {
|
|||
}
|
||||
},
|
||||
function (err) {
|
||||
return cb(err);
|
||||
if (err && ! err.toString().match(/E11000/)) return cb(err);
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -45,7 +45,6 @@ function spec() {
|
|||
function(c) {
|
||||
Block.findOne({hash:blockHash}, function(err,block){
|
||||
if (err) { console.log(err); return c(err); };
|
||||
|
||||
if (block) {
|
||||
existed = 1;
|
||||
blockObj = block;
|
||||
|
|
Loading…
Reference in New Issue