Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 564 Lines • ▼ Show 20 Lines | for (const std::string &name_ : addrList) { | ||||
CScript scriptPubKey = GetScriptForDestination(destination); | CScript scriptPubKey = GetScriptForDestination(destination); | ||||
Amount nAmount = AmountFromValue(sendTo[name_]); | Amount nAmount = AmountFromValue(sendTo[name_]); | ||||
CTxOut out(nAmount, scriptPubKey); | CTxOut out(nAmount, scriptPubKey); | ||||
rawTx.vout.push_back(out); | rawTx.vout.push_back(out); | ||||
} | } | ||||
} | } | ||||
return EncodeHexTx(rawTx); | return EncodeHexTx(CTransaction(rawTx)); | ||||
} | } | ||||
static UniValue decoderawtransaction(const Config &config, | static UniValue decoderawtransaction(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"decoderawtransaction \"hexstring\"\n" | "decoderawtransaction \"hexstring\"\n" | ||||
"\nReturn a JSON object representing the serialized, hex-encoded " | "\nReturn a JSON object representing the serialized, hex-encoded " | ||||
▲ Show 20 Lines • Show All 484 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < mergedTx.vin.size(); i++) { | ||||
TransactionSignatureChecker(&txConst, i, amount), &serror)) { | TransactionSignatureChecker(&txConst, i, amount), &serror)) { | ||||
TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror)); | TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror)); | ||||
} | } | ||||
} | } | ||||
bool fComplete = vErrors.empty(); | bool fComplete = vErrors.empty(); | ||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
result.push_back(Pair("hex", EncodeHexTx(mergedTx))); | result.push_back(Pair("hex", EncodeHexTx(CTransaction(mergedTx)))); | ||||
result.push_back(Pair("complete", fComplete)); | result.push_back(Pair("complete", fComplete)); | ||||
if (!vErrors.empty()) { | if (!vErrors.empty()) { | ||||
result.push_back(Pair("errors", vErrors)); | result.push_back(Pair("errors", vErrors)); | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |