Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 1,240 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < psbtx.inputs.size(); ++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", ValueFromAmount(txout.nValue)); | ||||
if (MoneyRange(txout.nValue) && | |||||
MoneyRange(total_in + txout.nValue)) { | |||||
total_in += txout.nValue; | total_in += txout.nValue; | ||||
} else { | |||||
// Hack to just not show fee later | |||||
have_all_utxos = false; | |||||
} | |||||
UniValue o(UniValue::VOBJ); | UniValue o(UniValue::VOBJ); | ||||
ScriptToUniv(txout.scriptPubKey, o, true); | ScriptToUniv(txout.scriptPubKey, o, true); | ||||
out.pushKV("scriptPubKey", o); | out.pushKV("scriptPubKey", o); | ||||
in.pushKV("utxo", out); | in.pushKV("utxo", out); | ||||
} else { | } else { | ||||
have_all_utxos = false; | have_all_utxos = false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < psbtx.outputs.size(); ++i) { | ||||
unknowns.pushKV(HexStr(entry.first), HexStr(entry.second)); | unknowns.pushKV(HexStr(entry.first), HexStr(entry.second)); | ||||
} | } | ||||
out.pushKV("unknown", unknowns); | out.pushKV("unknown", unknowns); | ||||
} | } | ||||
outputs.push_back(out); | outputs.push_back(out); | ||||
// Fee calculation | // Fee calculation | ||||
if (MoneyRange(psbtx.tx->vout[i].nValue) && | |||||
MoneyRange(output_value + psbtx.tx->vout[i].nValue)) { | |||||
output_value += psbtx.tx->vout[i].nValue; | output_value += psbtx.tx->vout[i].nValue; | ||||
} else { | |||||
// Hack to just not show fee later | |||||
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", ValueFromAmount(total_in - output_value)); | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 652 Lines • Show Last 20 Lines |