20 bool all_final =
true;
21 bool only_missing_sigs =
true;
22 bool only_missing_final =
false;
25 result.
inputs.resize(psbtx.
tx->vin.size());
27 for (
size_t i = 0; i < psbtx.
tx->vin.size(); ++i) {
36 "PSBT is not valid. Input %u has invalid value", i));
50 "PSBT is not valid. Input %u spends unspendable output", i));
78 only_missing_sigs =
false;
82 only_missing_final =
true;
85 }
else if (!utxo.
IsNull()) {
91 only_missing_sigs =
false;
97 std::accumulate(psbtx.
tx->vout.begin(), psbtx.
tx->vout.end(),
103 return a += b.nValue;
107 strprintf(
"PSBT is not valid. Output amount invalid"));
112 Amount fee = in_amt - out_amt;
121 for (
size_t i = 0; i < psbtx.
tx->vin.size(); ++i) {
132 view.
AddCoin(psbtx.
tx->vin[i].prevout,
Coin(newUtxo, 1,
false),
146 if (only_missing_sigs) {
148 }
else if (only_missing_final) {
150 }
else if (all_final) {
static constexpr Amount zero()
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
Provides helpful miscellaneous information about where a PSBT is in the signing workflow.
std::vector< PSBTInputAnalysis > inputs
More information about the individual inputs of the transaction.
std::vector< CKeyID > missing_sigs
KeyIDs of pubkeys for signatures which could not be found.
std::vector< CKeyID > missing_pubkeys
KeyIDs of pubkeys which could not be found.
PSBTRole next
Which of the BIP 174 roles needs to handle the transaction next.
std::optional< CFeeRate > estimated_feerate
Estimated feerate (fee / weight) of the transaction.
Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)
static constexpr Amount SATOSHI
A version of CTransaction with the PSBT format.
std::optional< size_t > estimated_vsize
Estimated weight of the transaction.
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack...
bool MoneyRange(const Amount nValue)
uint160 missing_redeem_script
ScriptID of the missing redeemScript (if any)
Abstract view on the open txout dataset.
void SetInvalid(std::string err_msg)
void AddCoin(const COutPoint &outpoint, Coin coin, bool possible_overwrite)
Add a coin.
const SigningProvider & DUMMY_SIGNING_PROVIDER
An output of a transaction.
bool SignPSBTInput(const SigningProvider &provider, PartiallySignedTransaction &psbt, int index, SigHashType sighash, SignatureData *out_sigdata, bool use_dummy)
Signs a PSBTInput, verifying that all provided data matches what is being signed. ...
std::vector< PSBTInput > inputs
A mutable version of CTransaction.
Fee rate in satoshis per kilobyte: Amount / kB.
bool PSBTInputSigned(const PSBTInput &input)
Checks whether a PSBTInput is already signed.
unsigned int GetTotalSize() const
Get the total transaction size in bytes.
The basic transaction that is broadcasted on the network and contained in blocks. ...
CCoinsView that adds a memory cache for transactions to another CCoinsView.
std::optional< CMutableTransaction > tx
bool GetInputUTXO(CTxOut &utxo, int input_index) const
Finds the UTXO for a given input index.
std::optional< Amount > fee
Amount of fee being paid by the transaction.
Signature hash type wrapper class.