check IsMine for tx conversions.

This commit is contained in:
Christopher Jeffrey 2014-11-18 15:42:15 -08:00
parent d8701332c0
commit d50c103c00
1 changed files with 33 additions and 22 deletions

View File

@ -5699,6 +5699,16 @@ ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local<Object> jstx) {
jstx->Set(NanNew<String>("timereceived"), jstx->Set(NanNew<String>("timereceived"),
NanNew<Number>((uint32_t)mapBlockIndex[block_hash]->GetBlockTime())->ToUint32()); NanNew<Number>((uint32_t)mapBlockIndex[block_hash]->GetBlockTime())->ToUint32());
#if 0 #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<String>("blockhash"), NanNew<String>(block_hash.GetHex())); jstx->Set(NanNew<String>("blockhash"), NanNew<String>(block_hash.GetHex()));
CWalletTx cwtx(pwalletMain, ctx); CWalletTx cwtx(pwalletMain, ctx);
int confirms = cwtx.GetDepthInMainChain(); int confirms = cwtx.GetDepthInMainChain();
@ -5723,6 +5733,7 @@ ctx_to_jstx(const CTransaction& ctx, uint256& block_hash, Local<Object> jstx) {
jstx->Set(NanNew<String>("walletconflicts"), conflicts); jstx->Set(NanNew<String>("walletconflicts"), conflicts);
jstx->Set(NanNew<String>("time"), NanNew<Number>(cwtx.GetTxTime())); jstx->Set(NanNew<String>("time"), NanNew<Number>(cwtx.GetTxTime()));
jstx->Set(NanNew<String>("timereceived"), NanNew<Number>((int64_t)cwtx.nTimeReceived)); jstx->Set(NanNew<String>("timereceived"), NanNew<Number>((int64_t)cwtx.nTimeReceived));
}
#endif #endif
} else { } else {
jstx->Set(NanNew<String>("blockhash"), NanNew<String>(uint256(0).GetHex())); jstx->Set(NanNew<String>("blockhash"), NanNew<String>(uint256(0).GetHex()));