[#Consensus-CheckTxInputs]
= xref:Consensus.adoc[Consensus]::CheckTxInputs
:relfileprefix: ../
:mrdocs:

Check whether all inputs of this transaction are valid (no double spends and amounts) This does not modify the UTXO set&period; This does not check scripts and sigs&period;

== Synopsis

Declared in `&lt;consensus&sol;tx&lowbar;verify&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
bool
CheckTxInputs(
    xref:CTransaction.adoc[CTransaction] const& tx,
    xref:TxValidationState.adoc[TxValidationState]& state,
    xref:CCoinsViewCache.adoc[CCoinsViewCache] const& inputs,
    int nSpendHeight,
    xref:CAmount.adoc[CAmount]& txfee);
----

== Return Value

true if all inputs exist, are spendable, and amounts balance&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *txfee* [out]
| Set to the transaction fee if successful&period; Preconditions&colon; tx&period;IsCoinBase() is false&period;
| *tx*
| The non&hyphen;coinbase transaction whose inputs are checked&period;
| *state*
| Receives the validation result and rejection reason on failure&period;
| *inputs*
| UTXO set view providing the outputs spent by tx&period;
| *nSpendHeight*
| Height at which tx is being spent, used for maturity checks&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
