zcash_client_backend: Add `target_height` to `SentTransaction`

This commit is contained in:
Kris Nuttycombe 2024-08-09 14:09:31 -06:00
parent d96bc11055
commit 8752ad7e19
5 changed files with 14 additions and 3 deletions

View File

@ -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

View File

@ -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<AccountId>],
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<AccountId>],
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.

View File

@ -668,6 +668,7 @@ where
transactions.push(SentTransaction::new(
tx,
created,
proposal.min_target_height(),
account_id,
&step_result.outputs,
step_result.fee_amount,

View File

@ -1857,7 +1857,7 @@ pub(crate) fn store_transaction_to_be_sent<P: consensus::Parameters>(
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;

View File

@ -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."
}
}