diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index 5010448c0..92dc478fe 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -86,6 +86,8 @@ funds to those addresses. See [ZIP 320](https://zips.z.cash/zip-0320) for detail - `DecryptedTransaction::new` takes an additional `mined_height` argument. - `SentTransaction` now stores its `outputs` and `utxos_spent` fields as references to slices, with a corresponding change to `SentTransaction::new`. + - `SentTransaction` takes an additional `target_height` argument, which is used + to record the target height used in transaction generation. - `zcash_client_backend::data_api::fees` - When the "transparent-inputs" feature is enabled, `ChangeValue` can also represent an ephemeral transparent output in a proposal. Accordingly, the diff --git a/zcash_client_backend/src/data_api.rs b/zcash_client_backend/src/data_api.rs index 47b26c4ef..524e9e684 100644 --- a/zcash_client_backend/src/data_api.rs +++ b/zcash_client_backend/src/data_api.rs @@ -1395,6 +1395,7 @@ impl<'a, AccountId> DecryptedTransaction<'a, AccountId> { pub struct SentTransaction<'a, AccountId> { tx: &'a Transaction, created: time::OffsetDateTime, + target_height: BlockHeight, account: AccountId, outputs: &'a [SentTransactionOutput], fee_amount: NonNegativeAmount, @@ -1407,6 +1408,7 @@ impl<'a, AccountId> SentTransaction<'a, AccountId> { pub fn new( tx: &'a Transaction, created: time::OffsetDateTime, + target_height: BlockHeight, account: AccountId, outputs: &'a [SentTransactionOutput], fee_amount: NonNegativeAmount, @@ -1415,6 +1417,7 @@ impl<'a, AccountId> SentTransaction<'a, AccountId> { Self { tx, created, + target_height, account, outputs, fee_amount, @@ -1448,6 +1451,11 @@ impl<'a, AccountId> SentTransaction<'a, AccountId> { pub fn utxos_spent(&self) -> &[OutPoint] { self.utxos_spent } + + /// Returns the block height that this transaction was created to target. + pub fn target_height(&self) -> BlockHeight { + self.target_height + } } /// An output of a transaction generated by the wallet. diff --git a/zcash_client_backend/src/data_api/wallet.rs b/zcash_client_backend/src/data_api/wallet.rs index 4508d0d9e..e94dc96a5 100644 --- a/zcash_client_backend/src/data_api/wallet.rs +++ b/zcash_client_backend/src/data_api/wallet.rs @@ -668,6 +668,7 @@ where transactions.push(SentTransaction::new( tx, created, + proposal.min_target_height(), account_id, &step_result.outputs, step_result.fee_amount, diff --git a/zcash_client_sqlite/src/wallet.rs b/zcash_client_sqlite/src/wallet.rs index 318bc63f0..aa92b7466 100644 --- a/zcash_client_sqlite/src/wallet.rs +++ b/zcash_client_sqlite/src/wallet.rs @@ -1857,7 +1857,7 @@ pub(crate) fn store_transaction_to_be_sent( sent_tx.tx(), Some(sent_tx.fee_amount()), Some(sent_tx.created()), - chain_tip_height(wdb.conn.0)?.map(|h| h + 1), + Some(sent_tx.target_height()), )?; let mut detectable_via_scanning = false; diff --git a/zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs b/zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs index d03c9d17f..3962dbeca 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs @@ -1,4 +1,4 @@ -//! A migration to add the `tx_retrieval_queue` table to the database. +//! Adds tables for tracking transactions to be downloaded for transparent output and/or memo retrieval. use rusqlite::{named_params, Transaction}; use schemer_rusqlite::RusqliteMigration; @@ -24,7 +24,7 @@ impl schemer::Migration for Migration { } fn description(&self) -> &'static str { - "Adds a table for tracking transactions to be downloaded for transparent output and/or memo retrieval." + "Adds tables for tracking transactions to be downloaded for transparent output and/or memo retrieval." } }