diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index 53063bcb..1b81ba79 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -392,7 +392,7 @@ static inline void cblock_to_jsblock(const CBlock& cblock, CBlockIndex* cblock_index, Local jsblock, bool is_new); static inline void -ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local jstx); +ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx); static inline void jsblock_to_cblock(const Local jsblock, CBlock& cblock); @@ -1567,8 +1567,7 @@ NAN_METHOD(FillTransaction) { // Turn our CTransaction into a javascript Transaction Local new_jstx = NanNew(); - uint256 block_hash = uint256(0); - ctx_to_jstx(ctx, block_hash, new_jstx); + ctx_to_jstx(ctx, 0, new_jstx); NanReturnValue(new_jstx); } @@ -2291,8 +2290,7 @@ NAN_METHOD(TxFromHex) { } Local jstx = NanNew(); - uint256 block_hash = uint256(0); - ctx_to_jstx(ctx, block_hash, jstx); + ctx_to_jstx(ctx, 0, jstx); NanReturnValue(jstx); } @@ -2557,8 +2555,7 @@ NAN_METHOD(HookPackets) { CTransaction tx; vRecv >> tx; Local jstx = NanNew(); - uint256 block_hash = uint256(0); - ctx_to_jstx(tx, block_hash, jstx); + ctx_to_jstx(tx, 0, jstx); o->Set(NanNew("tx"), jstx); } else if (strCommand == "block" && !fImporting && !fReindex) { // XXX May be able to do prev_list asynchronously @@ -5593,7 +5590,7 @@ cblock_to_jsblock(const CBlock& cblock, CBlockIndex* cblock_index, Local } static inline void -ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local jstx) { +ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { // With v0.9.0 // jstx->Set(NanNew("mintxfee"), NanNew((int64_t)ctx.nMinTxFee)->ToInteger()); // jstx->Set(NanNew("minrelaytxfee"), NanNew((int64_t)ctx.nMinRelayTxFee)->ToInteger()); @@ -5646,6 +5643,7 @@ ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local jstx) { } jstx->Set(NanNew("vin"), vin); + //bool is_mine = false; Local vout = NanNew(); for (unsigned int vo = 0; vo < ctx.vout.size(); vo++) { const CTxOut& txout = ctx.vout[vo]; @@ -5659,6 +5657,10 @@ ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local jstx) { const CScript& scriptPubKey = txout.scriptPubKey; Local out = o; + //if (IsMine(*pwalletMain, scriptPubKey)) { + // is_mine = true; + //} + txnouttype type; vector addresses; int nRequired; @@ -5684,7 +5686,7 @@ ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local jstx) { } jstx->Set(NanNew("vout"), vout); - if (block_hash != uint256(0)) { + if (block_hash != 0) { jstx->Set(NanNew("blockhash"), NanNew(block_hash.GetHex())); jstx->Set(NanNew("confirmations"), NanNew(0)); if (ctx.IsCoinBase()) { @@ -5699,15 +5701,6 @@ ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local jstx) { jstx->Set(NanNew("timereceived"), NanNew((uint32_t)mapBlockIndex[block_hash]->GetBlockTime())->ToUint32()); #if 0 - bool is_mine = false; - for (unsigned int vo = 0; vo < ctx.vout.size(); vo++) { - const CTxOut& txout = ctx.vout[vo]; - const CScript& scriptPubKey = txout.scriptPubKey; - if (IsMine(*pwalletMain, scriptPubKey)) { - is_mine = true; - break; - } - } if (is_mine) { jstx->Set(NanNew("blockhash"), NanNew(block_hash.GetHex())); CWalletTx cwtx(pwalletMain, ctx);