Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 1,357 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < psbtx.inputs.size(); ++i) { | ||||
const PSBTInput &input = psbtx.inputs[i]; | const PSBTInput &input = psbtx.inputs[i]; | ||||
UniValue in(UniValue::VOBJ); | UniValue in(UniValue::VOBJ); | ||||
// UTXOs | // UTXOs | ||||
if (!input.utxo.IsNull()) { | if (!input.utxo.IsNull()) { | ||||
const CTxOut &txout = input.utxo; | const CTxOut &txout = input.utxo; | ||||
UniValue out(UniValue::VOBJ); | UniValue out(UniValue::VOBJ); | ||||
out.pushKV("amount", ValueFromAmount(txout.nValue)); | out.pushKV("amount", txout.nValue); | ||||
if (MoneyRange(txout.nValue) && | if (MoneyRange(txout.nValue) && | ||||
MoneyRange(total_in + txout.nValue)) { | MoneyRange(total_in + txout.nValue)) { | ||||
total_in += txout.nValue; | total_in += txout.nValue; | ||||
} else { | } else { | ||||
// Hack to just not show fee later | // Hack to just not show fee later | ||||
have_all_utxos = false; | have_all_utxos = false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < psbtx.outputs.size(); ++i) { | ||||
output_value += psbtx.tx->vout[i].nValue; | output_value += psbtx.tx->vout[i].nValue; | ||||
} else { | } else { | ||||
// Hack to just not show fee later | // Hack to just not show fee later | ||||
have_all_utxos = false; | have_all_utxos = false; | ||||
} | } | ||||
} | } | ||||
result.pushKV("outputs", outputs); | result.pushKV("outputs", outputs); | ||||
if (have_all_utxos) { | if (have_all_utxos) { | ||||
result.pushKV("fee", ValueFromAmount(total_in - output_value)); | result.pushKV("fee", total_in - output_value); | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
static UniValue combinepsbt(const Config &config, | static UniValue combinepsbt(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
▲ Show 20 Lines • Show All 625 Lines • ▼ Show 20 Lines | UniValue analyzepsbt(const Config &config, const JSONRPCRequest &request) { | ||||
if (!inputs_result.empty()) { | if (!inputs_result.empty()) { | ||||
result.pushKV("inputs", inputs_result); | result.pushKV("inputs", inputs_result); | ||||
} | } | ||||
if (psbta.estimated_vsize != std::nullopt) { | if (psbta.estimated_vsize != std::nullopt) { | ||||
result.pushKV("estimated_vsize", (int)*psbta.estimated_vsize); | result.pushKV("estimated_vsize", (int)*psbta.estimated_vsize); | ||||
} | } | ||||
if (psbta.estimated_feerate != std::nullopt) { | if (psbta.estimated_feerate != std::nullopt) { | ||||
result.pushKV("estimated_feerate", | result.pushKV("estimated_feerate", | ||||
ValueFromAmount(psbta.estimated_feerate->GetFeePerK())); | psbta.estimated_feerate->GetFeePerK()); | ||||
} | } | ||||
if (psbta.fee != std::nullopt) { | if (psbta.fee != std::nullopt) { | ||||
result.pushKV("fee", ValueFromAmount(*psbta.fee)); | result.pushKV("fee", *psbta.fee); | ||||
} | } | ||||
result.pushKV("next", PSBTRoleName(psbta.next)); | result.pushKV("next", PSBTRoleName(psbta.next)); | ||||
if (!psbta.error.empty()) { | if (!psbta.error.empty()) { | ||||
result.pushKV("error", psbta.error); | result.pushKV("error", psbta.error); | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
Show All 31 Lines |