Remove logs

feature/default_network_editable
Dan Finlay 7 years ago
parent a95a3c7e4f
commit c616581001
  1. 8
      app/scripts/lib/pending-balance-calculator.js
  2. 5
      test/unit/pending-balance-test.js

@ -15,7 +15,6 @@ class PendingBalanceCalculator {
} }
async getBalance() { async getBalance() {
console.log('getting balance')
const results = await Promise.all([ const results = await Promise.all([
this.getNetworkBalance(), this.getNetworkBalance(),
this.getPendingTransactions(), this.getPendingTransactions(),
@ -24,23 +23,16 @@ class PendingBalanceCalculator {
const balance = results[0] const balance = results[0]
const pending = results[1] const pending = results[1]
console.dir(pending)
console.dir(balance.toString())
console.trace('but why')
const pendingValue = pending.reduce((total, tx) => { const pendingValue = pending.reduce((total, tx) => {
return total.add(this.valueFor(tx)) return total.add(this.valueFor(tx))
}, new BN(0)) }, new BN(0))
console.log(`subtracting ${pendingValue.toString()} from ${balance.toString()}`)
return `0x${ balance.sub(pendingValue).toString(16) }` return `0x${ balance.sub(pendingValue).toString(16) }`
} }
valueFor (tx) { valueFor (tx) {
const txValue = tx.txParams.value const txValue = tx.txParams.value
const normalized = normalize(txValue).substring(2) const normalized = normalize(txValue).substring(2)
console.log({ txValue, normalized })
const value = this.hexToBn(txValue) const value = this.hexToBn(txValue)
return value return value
} }

@ -57,12 +57,7 @@ describe('PendingBalanceCalculator', function () {
}) })
it('returns the network balance', async function () { it('returns the network balance', async function () {
console.log('one')
console.dir(balanceCalculator)
console.dir(balanceCalculator.getBalance.toString())
const result = await balanceCalculator.getBalance() const result = await balanceCalculator.getBalance()
console.log('two')
console.dir(result)
assert.equal(result, '0x0', `gave ${result} needed '0x0'`) assert.equal(result, '0x0', `gave ${result} needed '0x0'`)
return true return true
}) })

Loading…
Cancel
Save