aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-08-22 23:43:31 -0700
committerAdam Soltys <[email protected]>2014-08-22 23:43:31 -0700
commit23a8677ed4353f3f0b9072a50d07c2febb511444 (patch)
tree32a7a053dc3b586db770fba2f367e6b8a42ae632 /public
parentdec12454289461e6851b3b7328b5a80f56ce4a98 (diff)
downloadcoinos-server-23a8677ed4353f3f0b9072a50d07c2febb511444.tar.gz
coinos-server-23a8677ed4353f3f0b9072a50d07c2febb511444.zip
Move txid check
Diffstat (limited to 'public')
-rw-r--r--public/js/calculator.coffee9
1 files changed, 5 insertions, 4 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee
index e1e97cef..29c1d006 100644
--- a/public/js/calculator.coffee
+++ b/public/js/calculator.coffee
@@ -161,20 +161,21 @@ setupSocket = ->
g.btcd.onmessage = (e) ->
data = JSON.parse(e.data)
- txid = data.result.txid
- return if txid == g.last
- g.last = txid
amount_received = 0
if data.result
+ txid = data.result.txid
+ return if txid == g.last
+ g.last = txid
+
for output in data.result.vout
if g.address in output.scriptPubKey.addresses
amount_received += parseFloat(output.value)
if g.user
$.post("/#{g.user}/transactions",
- txid: data.result.txid,
+ txid: txid,
date: moment().format("YYYY-MM-DD HH:mm:ss"),
received: amount_received,
tip: g.tip,