fix hash in block historical sync
This commit is contained in:
parent
4457342af0
commit
2aefe7119d
|
@ -51,10 +51,11 @@ BlockSchema.statics.customCreate = function(block, cb) {
|
|||
var newBlock = new That();
|
||||
|
||||
newBlock.time = block.time ? block.time : Math.round(new Date().getTime() / 1000);
|
||||
newBlock.hash = block.blockHash;
|
||||
newBlock.hash = block.hash;
|
||||
|
||||
Transaction.createFromArray(block.tx, newBlock.time, function(err, inserted_txs) {
|
||||
if (err) return cb(err);
|
||||
|
||||
newBlock.save(function(err) {
|
||||
return cb(err, inserted_txs);
|
||||
});
|
||||
|
|
|
@ -94,7 +94,7 @@ TransactionSchema.statics.createFromArray = function(txs, time, next) {
|
|||
|
||||
async.forEachLimit(txs, CONCURRENCY, function(txid, cb) {
|
||||
|
||||
that.explodeTransactionItems( txid, function(err) {
|
||||
that.explodeTransactionItems( txid, time, function(err) {
|
||||
if (err) return next(err);
|
||||
|
||||
that.create({txid: txid, time: time}, function(err, new_tx) {
|
||||
|
|
|
@ -227,7 +227,7 @@ function spec() {
|
|||
}
|
||||
|
||||
// This will trigger an RPC call
|
||||
Transaction.explodeTransactionItems( tx.txid, function(err) {
|
||||
Transaction.explodeTransactionItems( tx.txid, tx.time, function(err) {
|
||||
if (proc++ % 1000 === 0) progress_bar('\tproc', pull, total);
|
||||
next(err);
|
||||
});
|
||||
|
|
|
@ -118,7 +118,8 @@ describe('Transaction', function(){
|
|||
// Remove first
|
||||
TransactionItem.remove({txid: v.txid}, function(err) {
|
||||
|
||||
Transaction.explodeTransactionItems(v.txid, function(err, tx) {
|
||||
var now = Math.round(new Date().getTime() / 1000);
|
||||
Transaction.explodeTransactionItems(v.txid, now, function(err, tx) {
|
||||
if (err) done(err);
|
||||
|
||||
TransactionItem
|
||||
|
|
Loading…
Reference in New Issue