From b37a66cdd82a585e08ac5287e4f5cf64c55d0b90 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 9 Dec 2014 14:20:59 -0800 Subject: [PATCH] check whether tx is owned by user earlier. --- src/bitcoindjs.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index 866709ec..065c56c4 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -5860,9 +5860,19 @@ get_tx(uint256 txid, uint256& blockhash, CTransaction& ctx) { static inline void ctx_to_jstx(const CTransaction& ctx, uint256 blockhash, Local jstx) { + // Find block hash if it's in our wallet + bool is_mine = false; + CWalletTx cwtx; + if (pwalletMain->mapWallet.count(ctx.GetHash())) { + cwtx = pwalletMain->mapWallet[ctx.GetHash()]; + blockhash.SetHex(cwtx.hashBlock.GetHex()); + is_mine = true; + } + // With v0.9.0 // jstx->Set(NanNew("mintxfee"), NanNew((int64_t)ctx.nMinTxFee)->ToInteger()); // jstx->Set(NanNew("minrelaytxfee"), NanNew((int64_t)ctx.nMinRelayTxFee)->ToInteger()); + jstx->Set(NanNew("current_version"), NanNew((int)ctx.CURRENT_VERSION)->ToInt32()); @@ -5980,14 +5990,6 @@ ctx_to_jstx(const CTransaction& ctx, uint256 blockhash, Local jstx) { } jstx->Set(NanNew("vout"), vout); - // Find block hash if it's in our wallet - bool is_mine = false; - CWalletTx cwtx; - if (pwalletMain->mapWallet.count(ctx.GetHash())) { - cwtx = pwalletMain->mapWallet[ctx.GetHash()]; - blockhash.SetHex(cwtx.hashBlock.GetHex()); - is_mine = true; - } jstx->Set(NanNew("ismine"), NanNew(is_mine)); if (blockhash != 0) {