|
|
@ -42,14 +42,16 @@ BlockSchema.path('title').validate(function(title) { |
|
|
|
* Statics |
|
|
|
*/ |
|
|
|
|
|
|
|
BlockSchema.statics.createTimestamped = function(block, cb) { |
|
|
|
BlockSchema.statics.customCreate = function(block, cb) { |
|
|
|
|
|
|
|
var That= this; |
|
|
|
var now = Math.round(new Date().getTime() / 1000); |
|
|
|
|
|
|
|
var BlockSchema = mongoose.model('Block', BlockSchema); |
|
|
|
|
|
|
|
var newBlock = new That(); |
|
|
|
newBlock.time = now; |
|
|
|
|
|
|
|
newBlock.time = block.time ? block.time : Math.round(new Date().getTime() / 1000); |
|
|
|
newBlock.hash = block.blockHash; |
|
|
|
|
|
|
|
Transaction.createFromArray(block.tx, function(err, inserted_txs) { |
|
|
|
if (err) return cb(err); |
|
|
|