add and use event "newTransaction"

pull/1/head
yann300 7 years ago
parent 93bc2a54ce
commit 0f668bd7a8
  1. 5
      src/app.js
  2. 5
      src/app/txListener.js

@ -873,9 +873,7 @@ function run () {
txlistener.startListening() txlistener.startListening()
txlistener.event.register('newBlock', (block) => { txlistener.event.register('newTransaction', (tx) => {
for (var t in block.transactions) {
var tx = block.transactions[t]
var resolvedTransaction = txlistener.resolvedTransaction(tx.hash) var resolvedTransaction = txlistener.resolvedTransaction(tx.hash)
var address = null var address = null
if (resolvedTransaction) { if (resolvedTransaction) {
@ -886,7 +884,6 @@ function run () {
resolvedContract: txlistener.resolvedContract(address), resolvedContract: txlistener.resolvedContract(address),
resolvedTransaction: resolvedTransaction resolvedTransaction: resolvedTransaction
}) })
}
}) })
// ----------------- autoCompile ----------------- // ----------------- autoCompile -----------------

@ -124,7 +124,10 @@ class TxListener {
_resolve (block, callback) { _resolve (block, callback) {
async.each(block.transactions, (tx, cb) => { async.each(block.transactions, (tx, cb) => {
this._resolveTx(tx, cb) this._resolveTx(tx, () => {
this.event.trigger('newTransaction', [tx])
cb()
})
}, () => { }, () => {
callback() callback()
}) })

Loading…
Cancel
Save