Address TX balance indexing fix
This commit is contained in:
+21
-17
@@ -85,23 +85,27 @@ function update_address(hash, blockheight, txid, amount, type, cb) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
AddressTx.findOneAndUpdate({a_id: hash, txid: txid}, {
|
||||
$set: {
|
||||
a_id: hash,
|
||||
balance: address.balance,
|
||||
blockindex: blockheight,
|
||||
txid: txid
|
||||
}
|
||||
}, {
|
||||
new: true,
|
||||
upsert: true
|
||||
}, function (err,addresstx) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
if ( hash != 'coinbase' ) {
|
||||
AddressTx.findOneAndUpdate({a_id: hash, txid: txid}, {
|
||||
$set: {
|
||||
a_id: hash,
|
||||
blockindex: blockheight,
|
||||
txid: txid,
|
||||
amount: address.balance
|
||||
}
|
||||
}, {
|
||||
new: true,
|
||||
upsert: true
|
||||
}, function (err,addresstx) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user