Fixed tx value out on home page
This commit is contained in:
parent
eb7e5d10c9
commit
46c9027bdb
@ -111,6 +111,7 @@ module.exports = function transactionAPI(router) {
|
|||||||
coinbase: input.script,
|
coinbase: input.script,
|
||||||
sequence: input.sequence,
|
sequence: input.sequence,
|
||||||
n: 0,
|
n: 0,
|
||||||
|
addr: input.address,
|
||||||
})),
|
})),
|
||||||
vout: tx.outputs.map(output => ({
|
vout: tx.outputs.map(output => ({
|
||||||
value: output.value / 1e8,
|
value: output.value / 1e8,
|
||||||
|
|||||||
@ -16,18 +16,19 @@ function parse(entry, txs) {
|
|||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
if (counter % socketThrottle === 0) {
|
if (counter % socketThrottle === 0) {
|
||||||
|
|
||||||
io.sockets.emit('tx', {
|
io.sockets.emit('tx', {
|
||||||
txid: txJSON.hash,
|
txid: txJSON.hash,
|
||||||
valueOut: tx.outputs.reduce((a, b) => {
|
valueOut: tx.outputs.reduce((sum, tx) => {
|
||||||
a = a.toJSON();
|
tx = tx.toJSON();
|
||||||
b = b.toJSON();
|
|
||||||
|
|
||||||
const valA = (a.value || a.valueOut.value || 0) / 1e8;
|
const valB = (tx.value || tx.valueOut.value || 0) / 1e8;
|
||||||
const valB = (b.value || b.valueOut.value || 0) / 1e8;
|
|
||||||
|
|
||||||
return valA + valB;
|
console.log(valB)
|
||||||
}),
|
|
||||||
}, 0);
|
return sum + valB;
|
||||||
|
}, 0),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const t = new TxModel({
|
const t = new TxModel({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user