AddressTX: include balance history and show in address history
This commit is contained in:
+13
-1
@@ -90,6 +90,7 @@ function update_address(hash, txid, amount, type, cb) {
|
||||
if (typeof address_tx == "undefined") {
|
||||
var newAddressTx = new AddressTx({
|
||||
a_id: hash,
|
||||
balance: received - sent,
|
||||
txid: txid
|
||||
});
|
||||
newAddressTx.save(function(err) {
|
||||
@@ -100,7 +101,13 @@ function update_address(hash, txid, amount, type, cb) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return cb(); //duplicate
|
||||
AddressTx.updateOne({a_id: hash, txid: txid}, {
|
||||
a_id: hash,
|
||||
balance: received - sent,
|
||||
txid: txid
|
||||
}, function() {
|
||||
return cb();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -127,6 +134,7 @@ function update_address(hash, txid, amount, type, cb) {
|
||||
} else {
|
||||
var newAddressTx = new AddressTx({
|
||||
a_id: hash,
|
||||
balance: amount,
|
||||
txid: txid
|
||||
});
|
||||
newAddressTx.save(function(err) {
|
||||
@@ -514,9 +522,13 @@ module.exports = {
|
||||
var i = loop.iteration();
|
||||
find_tx(hashes[i].txid, function (tx) {
|
||||
if (tx && !txs.includes(tx)) {
|
||||
// tx = {...hashes[i], ...tx}
|
||||
tx.balance = hashes[i].balance;
|
||||
txs.push(tx);
|
||||
loop.next();
|
||||
} else if (!txs.includes(tx)) {
|
||||
// tx = {...hashes[i], ...tx}
|
||||
tx.balance = hashes[i].balance;
|
||||
txs.push("1. Not found");
|
||||
loop.next();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user