diff --git a/src/psbt.h b/src/psbt.h --- a/src/psbt.h +++ b/src/psbt.h @@ -53,7 +53,6 @@ void FillSignatureData(SignatureData &sigdata) const; void FromSignatureData(const SignatureData &sigdata); void Merge(const PSBTInput &input); - bool IsSane() const; PSBTInput() {} template inline void Serialize(Stream &s) const { @@ -239,7 +238,6 @@ void FillSignatureData(SignatureData &sigdata) const; void FromSignatureData(const SignatureData &sigdata); void Merge(const PSBTOutput &output); - bool IsSane() const; PSBTOutput() {} template inline void Serialize(Stream &s) const { @@ -346,7 +344,6 @@ * the merge succeeded, false otherwise. */ NODISCARD bool Merge(const PartiallySignedTransaction &psbt); - bool IsSane() const; bool AddInput(const CTxIn &txin, PSBTInput &psbtin); bool AddOutput(const CTxOut &txout, const PSBTOutput &psbtout); PartiallySignedTransaction() {} @@ -500,10 +497,6 @@ throw std::ios_base::failure("Outputs provided does not match the " "number of outputs in transaction."); } - // Sanity check - if (!IsSane()) { - throw std::ios_base::failure("PSBT is not sane."); - } } template diff --git a/src/psbt.cpp b/src/psbt.cpp --- a/src/psbt.cpp +++ b/src/psbt.cpp @@ -34,15 +34,6 @@ return true; } -bool PartiallySignedTransaction::IsSane() const { - for (PSBTInput input : inputs) { - if (!input.IsSane()) { - return false; - } - } - return true; -} - bool PartiallySignedTransaction::AddInput(const CTxIn &txin, PSBTInput &psbtin) { if (std::find(tx->vin.begin(), tx->vin.end(), txin) != tx->vin.end()) { @@ -134,10 +125,6 @@ } } -bool PSBTInput::IsSane() const { - return true; -} - void PSBTOutput::FillSignatureData(SignatureData &sigdata) const { if (!redeem_script.empty()) { sigdata.redeem_script = redeem_script; @@ -213,11 +200,6 @@ // Get UTXO CTxOut utxo; - // Verify input sanity - if (!input.IsSane()) { - return false; - } - if (input.utxo.IsNull()) { return false; } @@ -289,9 +271,6 @@ return TransactionError::PSBT_MISMATCH; } } - if (!out.IsSane()) { - return TransactionError::INVALID_PSBT; - } return TransactionError::OK; } diff --git a/src/test/fuzz/psbt.cpp b/src/test/fuzz/psbt.cpp --- a/src/test/fuzz/psbt.cpp +++ b/src/test/fuzz/psbt.cpp @@ -36,7 +36,6 @@ } (void)psbt.IsNull(); - (void)psbt.IsSane(); std::optional tx = psbt.tx; if (tx) { @@ -47,7 +46,6 @@ for (const PSBTInput &input : psbt.inputs) { (void)PSBTInputSigned(input); (void)input.IsNull(); - (void)input.IsSane(); } for (const PSBTOutput &output : psbt.outputs) { diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -506,12 +506,6 @@ continue; } - // Verify input looks sane. This will check that we have at most one - // uxto, witness or non-witness. - if (!input.IsSane()) { - return TransactionError::INVALID_PSBT; - } - // Get the Sighash type if (sign && input.sighash_type.getRawSigHashType() > 0 && input.sighash_type != sighash_type) { @@ -2084,12 +2078,6 @@ continue; } - // Verify input looks sane. This will check that we have at most one - // uxto, witness or non-witness. - if (!input.IsSane()) { - return TransactionError::INVALID_PSBT; - } - // Get the Sighash type if (sign && input.sighash_type.getRawSigHashType() > 0 && input.sighash_type != sighash_type) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2812,11 +2812,6 @@ continue; } - // Verify input looks sane. - if (!input.IsSane()) { - return TransactionError::INVALID_PSBT; - } - // If we have no utxo, grab it from the wallet. if (input.utxo.IsNull()) { const TxId &txid = txin.prevout.GetTxId(); diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -92,6 +92,9 @@ rawtx = self.nodes[1].walletcreatefundedpsbt([{"txid": txid, "vout": p2pkh_pos}], { self.nodes[1].getnewaddress(): 9.99})['psbt'] walletprocesspsbt_out = self.nodes[1].walletprocesspsbt(rawtx) + # Make sure it has UTXOs + decoded = self.nodes[1].decodepsbt(walletprocesspsbt_out['psbt']) + assert 'utxo' in decoded['inputs'][0] assert_equal(walletprocesspsbt_out['complete'], True) self.nodes[1].sendrawtransaction( self.nodes[1].finalizepsbt(walletprocesspsbt_out['psbt'])['hex'])