Skip to main content

store_decrypted_tx

Function store_decrypted_tx 

Source
pub fn store_decrypted_tx<DbT, P>(
    wallet_db: &mut DbT,
    params: &P,
    gap_limits: GapLimits,
    chain_tip_height: BlockHeight,
    d_tx: DecryptedTransaction<'_, Transaction, <DbT as LowLevelWalletRead>::AccountId>,
) -> Result<(), <DbT as LowLevelWalletRead>::Error>
where DbT: StoreDecryptedTxDbT, <DbT as LowLevelWalletRead>::AccountId: Debug, <DbT as LowLevelWalletRead>::Error: From<BalanceError> + From<GapAddressesError<<DbT as LowLevelWalletRead>::Error>>, P: Parameters,
Expand description

Persists a decrypted transaction to the wallet database.

This function stores a transaction that has been decrypted by the wallet, including:

  • The transaction data and any computed fee (if all inputs are known)
  • Received shielded notes (Sapling and Orchard)
  • Sent outputs with recipient information
  • Transparent outputs received by or sent from the wallet
  • Nullifier tracking for spent notes

The function also queues requests for retrieval of any unknown transparent inputs, which may be needed to compute the transaction fee or track wallet history.

§Parameters

  • wallet_db: The wallet database to update.
  • params: The network parameters.
  • chain_tip_height: The current chain tip height, used as the observation height for unmined transactions.
  • d_tx: The decrypted transaction to store.

§Returns

Returns Ok(()) if the transaction was successfully stored, or an error if a database operation failed.