Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | static UniValue createrawtransaction(const Config &config, | ||||
for (const std::string &name_ : addrList) { | for (const std::string &name_ : addrList) { | ||||
if (name_ == "data") { | if (name_ == "data") { | ||||
std::vector<uint8_t> data = | std::vector<uint8_t> data = | ||||
ParseHexV(sendTo[name_].getValStr(), "Data"); | ParseHexV(sendTo[name_].getValStr(), "Data"); | ||||
CTxOut out(Amount(0), CScript() << OP_RETURN << data); | CTxOut out(Amount(0), CScript() << OP_RETURN << data); | ||||
rawTx.vout.push_back(out); | rawTx.vout.push_back(out); | ||||
} else { | } else { | ||||
CTxDestination destination = DecodeDestination(name_); | CTxDestination destination = | ||||
DecodeDestination(name_, config.GetChainParams()); | |||||
if (!IsValidDestination(destination)) { | if (!IsValidDestination(destination)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
std::string("Invalid Bitcoin address: ") + | std::string("Invalid Bitcoin address: ") + | ||||
name_); | name_); | ||||
} | } | ||||
if (!destinations.insert(destination).second) { | if (!destinations.insert(destination).second) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
▲ Show 20 Lines • Show All 636 Lines • Show Last 20 Lines |