diff --git a/example/index.js b/example/index.js index a6f7fce5..f6c6546a 100755 --- a/example/index.js +++ b/example/index.js @@ -15,9 +15,13 @@ bitcoind.start(function(err) { bitcoind.on('open', function(status) { console.log('bitcoind: status="%s"', status); // getBlocks(bitcoind); - bitcoind.on('block', function(block) { - console.log('Found block:'); - console.log(block); + // bitcoind.on('block', function(block) { + // console.log('Found block:'); + // console.log(block); + // }); + bitcoind.on('tx', function(tx) { + console.log('Found tx:'); + console.log(tx); }); }); }); diff --git a/lib/bitcoind.js b/lib/bitcoind.js index 80e02bab..94b800fd 100644 --- a/lib/bitcoind.js +++ b/lib/bitcoind.js @@ -146,8 +146,15 @@ Bitcoin.prototype.start = function(callback) { self.emit('block', block); - return setImmediate(function() { - nextBlock(); + return utils.forEach(block.tx, function(tx, nextTx) { + self.emit('tx', tx); + return setImmediate(function() { + return nextTx(); + }); + }, function() { + return setImmediate(function() { + return nextBlock(); + }); }); }, function() { return setTimeout(next, self.pollInterval);