Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | void TxToJSON(const Config &config, const CTransaction &tx, | ||||
entry.push_back(Pair("vout", vout)); | entry.push_back(Pair("vout", vout)); | ||||
if (!hashBlock.IsNull()) { | if (!hashBlock.IsNull()) { | ||||
entry.push_back(Pair("blockhash", hashBlock.GetHex())); | entry.push_back(Pair("blockhash", hashBlock.GetHex())); | ||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock); | BlockMap::iterator mi = mapBlockIndex.find(hashBlock); | ||||
if (mi != mapBlockIndex.end() && (*mi).second) { | if (mi != mapBlockIndex.end() && (*mi).second) { | ||||
CBlockIndex *pindex = (*mi).second; | CBlockIndex *pindex = (*mi).second; | ||||
if (chainActive.Contains(pindex)) { | if (chainActive.Contains(pindex)) { | ||||
entry.push_back(Pair("confirmations", 1 + chainActive.Height() - | entry.push_back( | ||||
pindex->nHeight)); | Pair("confirmations", | ||||
1 + chainActive.Height() - pindex->nHeight)); | |||||
entry.push_back(Pair("time", pindex->GetBlockTime())); | entry.push_back(Pair("time", pindex->GetBlockTime())); | ||||
entry.push_back(Pair("blocktime", pindex->GetBlockTime())); | entry.push_back(Pair("blocktime", pindex->GetBlockTime())); | ||||
} else { | } else { | ||||
entry.push_back(Pair("confirmations", 0)); | entry.push_back(Pair("confirmations", 0)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 824 Lines • ▼ Show 20 Lines | if (request.params.size() > 1 && !request.params[1].isNull()) { | ||||
view.AddCoin(out, Coin(txout, 1, false), true); | view.AddCoin(out, Coin(txout, 1, false), true); | ||||
} | } | ||||
// If redeemScript given and not using the local wallet (private | // If redeemScript given and not using the local wallet (private | ||||
// keys given), add redeemScript to the tempKeystore so it can be | // keys given), add redeemScript to the tempKeystore so it can be | ||||
// signed: | // signed: | ||||
if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) { | if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) { | ||||
RPCTypeCheckObj( | RPCTypeCheckObj( | ||||
prevOut, { | prevOut, | ||||
{ | |||||
{"txid", UniValueType(UniValue::VSTR)}, | {"txid", UniValueType(UniValue::VSTR)}, | ||||
{"vout", UniValueType(UniValue::VNUM)}, | {"vout", UniValueType(UniValue::VNUM)}, | ||||
{"scriptPubKey", UniValueType(UniValue::VSTR)}, | {"scriptPubKey", UniValueType(UniValue::VSTR)}, | ||||
{"redeemScript", UniValueType(UniValue::VSTR)}, | {"redeemScript", UniValueType(UniValue::VSTR)}, | ||||
}); | }); | ||||
UniValue v = find_value(prevOut, "redeemScript"); | UniValue v = find_value(prevOut, "redeemScript"); | ||||
if (!v.isNull()) { | if (!v.isNull()) { | ||||
std::vector<uint8_t> rsData(ParseHexV(v, "redeemScript")); | std::vector<uint8_t> rsData(ParseHexV(v, "redeemScript")); | ||||
CScript redeemScript(rsData.begin(), rsData.end()); | CScript redeemScript(rsData.begin(), rsData.end()); | ||||
tempKeystore.AddCScript(redeemScript); | tempKeystore.AddCScript(redeemScript); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |