From 61da977a3fdec76cbc47c4ff8ad33332e3c5d8a4 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 4 Jan 2016 05:03:24 -0800 Subject: [PATCH] miner: try to verify txs. --- lib/bcoin/miner.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/bcoin/miner.js b/lib/bcoin/miner.js index eccde6b6..c4d7f44f 100644 --- a/lib/bcoin/miner.js +++ b/lib/bcoin/miner.js @@ -36,14 +36,19 @@ exports.miner = function miner(options, callback) { } function addTX(tx) { - var s; + if (tx.inputs[0].output && !tx.verify()) + return; + if (tx.height !== -1) return; - s = tx.render().length; - if (block.size() + s > constants.blocks.maxSize) + + if (block.size() + tx.size() > constants.blocks.maxSize) return; + nextBlock.txs.push(tx); + fee.iadd(tx.getFee()); + // Update coinbase value updateCoinbase(nextBlock); // Update merkle root for new coinbase and new tx