add time to block for sorting

This commit is contained in:
Matias Alejo Garcia 2014-01-08 17:45:37 -03:00
parent 451b24d4a8
commit 6de5bf3566
2 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ var BlockSchema = new Schema({
index: true,
unique: true,
},
time: Number,
});

View File

@ -71,7 +71,7 @@ function spec(b) {
return this.getNextBlock(genesisHash, cb);
Block.findOne({}, {}, { sort: { 'confirmations' : 1 } }, function(err, block) {
Block.findOne({}, {}, { sort: { 'time' : -1 } }, function(err, block) {
if (err) return cb(err);
var nextHash =