MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SignTransactionResultToJSON

Function SignTransactionResultToJSON

src/rpc/rawtransaction_util.cpp:326–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map<COutPoint, Coin>& coins, const std::map<int, bilingual_str>& input_errors, UniValue& result)
327{
328 // Make errors UniValue
329 UniValue vErrors(UniValue::VARR);
330 for (const auto& err_pair : input_errors) {
331 if (err_pair.second.original == "Missing amount") {
332 // This particular error needs to be an exception for some reason
333 throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing amount for %s", coins.at(mtx.vin.at(err_pair.first).prevout).out.ToString()));
334 }
335 TxInErrorToJSON(mtx.vin.at(err_pair.first), vErrors, err_pair.second.original);
336 }
337
338 result.pushKV("hex", EncodeHexTx(CTransaction(mtx)));
339 result.pushKV("complete", complete);
340 if (!vErrors.empty()) {
341 if (result.exists("errors")) {
342 vErrors.push_backV(result["errors"].getValues());
343 }
344 result.pushKV("errors", std::move(vErrors));
345 }
346}
347
348std::vector<RPCResult> TxDoc(const TxDocOptions& opts)
349{

Callers 2

SignTransactionFunction · 0.85

Calls 10

JSONRPCErrorFunction · 0.85
TxInErrorToJSONFunction · 0.85
EncodeHexTxFunction · 0.85
pushKVMethod · 0.80
CTransactionClass · 0.50
ToStringMethod · 0.45
atMethod · 0.45
emptyMethod · 0.45
existsMethod · 0.45
push_backVMethod · 0.45

Tested by

no test coverage detected