diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index 1eb4f1ac..3b8ef04a 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -5866,11 +5866,14 @@ 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()); - jstx->Set(NanNew("current_version"), NanNew((int)ctx.CURRENT_VERSION)->ToInt32()); + jstx->Set(NanNew("current_version"), + NanNew((int)ctx.CURRENT_VERSION)->ToInt32()); jstx->Set(NanNew("txid"), NanNew(ctx.GetHash().GetHex())); - jstx->Set(NanNew("version"), NanNew((int)ctx.nVersion)->ToInt32()); - jstx->Set(NanNew("locktime"), NanNew((unsigned int)ctx.nLockTime)->ToUint32()); + jstx->Set(NanNew("version"), + NanNew((int)ctx.nVersion)->ToInt32()); + jstx->Set(NanNew("locktime"), + NanNew((unsigned int)ctx.nLockTime)->ToUint32()); jstx->Set(NanNew("size"), NanNew((int)::GetSerializeSize(ctx, SER_NETWORK, PROTOCOL_VERSION))->ToInt32()); @@ -5881,15 +5884,19 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { Local in = NanNew(); if (ctx.IsCoinBase()) { - in->Set(NanNew("coinbase"), NanNew(HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); + in->Set(NanNew("coinbase"), + NanNew(HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); } in->Set(NanNew("txid"), NanNew(txin.prevout.hash.GetHex())); - in->Set(NanNew("vout"), NanNew((unsigned int)txin.prevout.n)->ToUint32()); + in->Set(NanNew("vout"), + NanNew((unsigned int)txin.prevout.n)->ToUint32()); Local o = NanNew(); - o->Set(NanNew("asm"), NanNew(txin.scriptSig.ToString())); - o->Set(NanNew("hex"), NanNew(HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); + o->Set(NanNew("asm"), + NanNew(txin.scriptSig.ToString())); + o->Set(NanNew("hex"), + NanNew(HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); Local jsprev = NanNew(); CTransaction prev_tx; @@ -5899,8 +5906,10 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { CTxOut prev_out = prev_tx.vout[txin.prevout.n]; ExtractDestination(prev_out.scriptPubKey, from); CBitcoinAddress addrFrom(from); - jsprev->Set(NanNew("address"), NanNew(addrFrom.ToString())); - jsprev->Set(NanNew("value"), NanNew((int64_t)prev_out.nValue)->ToInteger()); + jsprev->Set(NanNew("address"), + NanNew(addrFrom.ToString())); + jsprev->Set(NanNew("value"), + NanNew((int64_t)prev_out.nValue)->ToInteger()); } else { const CTxOut& txout = ctx.vout[0]; const CScript& scriptPubKey = txout.scriptPubKey; @@ -5911,10 +5920,13 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { // Unknowns usually have the same first addr as the first output: // https://blockexplorer.com/testnet/block/ const CTxDestination& addr = addresses[0]; - jsprev->Set(NanNew("address"), NanNew(CBitcoinAddress(addr).ToString())); - jsprev->Set(NanNew("value"), NanNew((int64_t)txout.nValue)->ToInteger()); + jsprev->Set(NanNew("address"), + NanNew(CBitcoinAddress(addr).ToString() + std::string("?"))); + jsprev->Set(NanNew("value"), + NanNew((int64_t)txout.nValue)->ToInteger()); } else { - jsprev->Set(NanNew("address"), NanNew(std::string("Unknown"))); + jsprev->Set(NanNew("address"), + NanNew(std::string("Unknown"))); jsprev->Set(NanNew("value"), NanNew(0)); } } @@ -5946,12 +5958,16 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { vector addresses; int nRequired; out->Set(NanNew("asm"), NanNew(scriptPubKey.ToString())); - out->Set(NanNew("hex"), NanNew(HexStr(scriptPubKey.begin(), scriptPubKey.end()))); + out->Set(NanNew("hex"), + NanNew(HexStr(scriptPubKey.begin(), scriptPubKey.end()))); if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { - out->Set(NanNew("type"), NanNew(GetTxnOutputType(type))); + out->Set(NanNew("type"), + NanNew(GetTxnOutputType(type))); } else { - out->Set(NanNew("reqSigs"), NanNew((int)nRequired)->ToInt32()); - out->Set(NanNew("type"), NanNew(GetTxnOutputType(type))); + out->Set(NanNew("reqSigs"), + NanNew((int)nRequired)->ToInt32()); + out->Set(NanNew("type"), + NanNew(GetTxnOutputType(type))); Local a = NanNew(); int ai = 0; BOOST_FOREACH(const CTxDestination& addr, addresses) { @@ -6052,7 +6068,8 @@ ctx_to_jstx(const CTransaction& ctx, uint256 block_hash, Local jstx) { } jstx->Set(NanNew("walletconflicts"), conflicts); jstx->Set(NanNew("time"), NanNew(cwtx.GetTxTime())); - jstx->Set(NanNew("timereceived"), NanNew((int64_t)cwtx.nTimeReceived)); + jstx->Set(NanNew("timereceived"), + NanNew((int64_t)cwtx.nTimeReceived)); } } else { jstx->Set(NanNew("blockhash"), NanNew(uint256(0).GetHex()));