Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,806 Lines • ▼ Show 20 Lines | TransactionError CWallet::FillPSBT(PartiallySignedTransaction &psbtx, | ||||
for (size_t i = 0; i < psbtx.tx->vin.size(); ++i) { | for (size_t i = 0; i < psbtx.tx->vin.size(); ++i) { | ||||
const CTxIn &txin = psbtx.tx->vin[i]; | const CTxIn &txin = psbtx.tx->vin[i]; | ||||
PSBTInput &input = psbtx.inputs.at(i); | PSBTInput &input = psbtx.inputs.at(i); | ||||
if (PSBTInputSigned(input)) { | if (PSBTInputSigned(input)) { | ||||
continue; | continue; | ||||
} | } | ||||
// Verify input looks sane. | |||||
if (!input.IsSane()) { | |||||
return TransactionError::INVALID_PSBT; | |||||
} | |||||
// If we have no utxo, grab it from the wallet. | // If we have no utxo, grab it from the wallet. | ||||
if (input.utxo.IsNull()) { | if (input.utxo.IsNull()) { | ||||
const TxId &txid = txin.prevout.GetTxId(); | const TxId &txid = txin.prevout.GetTxId(); | ||||
const auto it = mapWallet.find(txid); | const auto it = mapWallet.find(txid); | ||||
if (it != mapWallet.end()) { | if (it != mapWallet.end()) { | ||||
const CWalletTx &wtx = it->second; | const CWalletTx &wtx = it->second; | ||||
CTxOut utxo = wtx.tx->vout[txin.prevout.GetN()]; | CTxOut utxo = wtx.tx->vout[txin.prevout.GetN()]; | ||||
// Update UTXOs from the wallet. | // Update UTXOs from the wallet. | ||||
▲ Show 20 Lines • Show All 2,224 Lines • Show Last 20 Lines |