diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index dc911f15..319f42b8 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -5691,18 +5691,24 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { if (ctx.IsCoinBase()) { jstx->Set(NanNew("generated"), NanNew(true)); } - CBlockIndex* pindex = mapBlockIndex[block_hash]; - if (pindex) { + if (mapBlockIndex.count(block_hash) > 0) { + CBlockIndex* pindex = mapBlockIndex[block_hash]; jstx->Set(NanNew("confirmations"), NanNew(pindex->nHeight)); jstx->Set(NanNew("blockindex"), NanNew(pindex->nHeight)); jstx->Set(NanNew("blocktime"), - NanNew(pindex->GetBlockTime())); + NanNew((int64_t)pindex->GetBlockTime())->ToInteger()); jstx->Set(NanNew("time"), - NanNew((uint32_t)pindex->GetBlockTime())->ToUint32()); + NanNew((int64_t)pindex->GetBlockTime())->ToInteger()); jstx->Set(NanNew("timereceived"), - NanNew((uint32_t)pindex->GetBlockTime())->ToUint32()); + NanNew((int64_t)pindex->GetBlockTime())->ToInteger()); + //jstx->Set(NanNew("blocktime"), + // NanNew(pindex->GetBlockTime())); + //jstx->Set(NanNew("time"), + // NanNew(pindex->GetBlockTime())); + //jstx->Set(NanNew("timereceived"), + // NanNew(pindex->GetBlockTime())); } else { jstx->Set(NanNew("confirmations"), NanNew(0)); jstx->Set(NanNew("blockindex"), NanNew(-1)); @@ -5710,8 +5716,7 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { jstx->Set(NanNew("time"), NanNew(0)); jstx->Set(NanNew("timereceived"), NanNew(0)); } - Local conflicts = NanNew(); - jstx->Set(NanNew("walletconflicts"), conflicts); + jstx->Set(NanNew("walletconflicts"), NanNew()); #if 0 if (is_mine) { jstx->Set(NanNew("blockhash"), NanNew(block_hash.GetHex()));