[#wallet-CWalletTx-Update]
= xref:wallet.adoc[wallet]::xref:wallet/CWalletTx.adoc[CWalletTx]::Update
:relfileprefix: ../../
:mrdocs:

Update the state of this wallet transaction along with a transaction that may have a different wtxid&period; If the given transaction has a different wtxid, the transaction is stored if it has not been seen before&period; The canonical wtxid is also updated&period; The tx that is confirmed becomes canonical&period; For unconfirmed txs, those with witnesses are preferred, followed by least weight&period;

== Synopsis

Declared in `&lt;wallet&sol;transaction&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
Update(
    xref:CTransactionRef.adoc[CTransactionRef] tx,
    xref:wallet/TxState.adoc[TxState] const& new&lowbar;state);
----

== Return Value

True if the stored transaction, state, or canonical wtxid changed&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *tx*
| The transaction to record, which may carry a different wtxid&period;
| *new&lowbar;state*
| The state to apply to this wallet transaction&period;
|===


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