From 614cb91dbf85b8945733ba8110abf06c3471a61a Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 8 Dec 2014 13:59:46 -0800 Subject: [PATCH] improve ismine. --- src/bitcoindjs.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index 6dd7154c..7f584990 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -6013,15 +6013,15 @@ ctx_to_jstx(const CTransaction& ctx, uint256 blockhash, Local jstx) { } #endif - CWalletTx cwtx(pwalletMain, ctx); - // XXX Determine wether this is our transaction - bool is_mine = cwtx.hashBlock != 0; - jstx->Set(NanNew("ismine"), NanNew(is_mine)); - // Find block hash if it's in our wallet - if (blockhash == 0 && is_mine) { - blockhash = cwtx.hashBlock; + 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) { jstx->Set(NanNew("blockhash"), NanNew(blockhash.GetHex()));