Commit Graph

343 Commits

Author SHA1 Message Date
Kris Nuttycombe b60600a4c3 zcash_client_sqlite: Use `ZcashAddress` for persistence of sent note addresses
Prior to this change, the recipient of a sent transaction would always
be shown as the protocol-level address, instead of any unified address
intended as the recipient. Now, instead of reencoding the recipient
address, we use the original `ZcashAddress` value from the payment
request.
2024-04-05 16:48:13 -06:00
Kris Nuttycombe 4ba7fbd977 zcash_client_sqlite: Clarify `TransferType` matches in `store_decrypted_tx` 2024-03-25 11:55:06 -06:00
Kris Nuttycombe 151e6e526e zcash_client_backend: Track external addresses in inter-account transactions.
Previously, if the funding account for a received transaction output was
determined to be an account known to the wallet, the output was recorded
as though it were sent to an internal (change) address of the wallet.
2024-03-25 07:59:21 -06:00
Kris Nuttycombe 404132bce5 zcash_client_sqlite: Use `get_funding_account` to determine whether an output is recorded as sent. 2024-03-25 07:59:21 -06:00
Kris Nuttycombe 33edf74126
Merge pull request #1300 from nuttycom/sqlite_wallet/expired_transaction_value 2024-03-25 00:22:36 -06:00
Kris Nuttycombe 874d6b608b zcash_client_backend: Ensure checkpoint at the end of each block.
This fixes an error wherein a note commitment in the last note
commitment position in a block was not being correctly marked as a
checkpoint.

This would occur when a block contained both Sapling and Orchard note
commitments, but the final transaction in the block contained only
either Sapling or Orchard note commitments, but not both.

Fixes #1302
2024-03-24 11:50:12 -06:00
Kris Nuttycombe 635057d86f zcash_client_sqlite: Avoid attempting to re-create already-pruned checkpoints. 2024-03-23 08:37:59 -06:00
Kris Nuttycombe fada46e638 zcash_client_sqlite: Fix balance in expired unmined transaction history.
Fixes #1292
Fixes #1299
2024-03-22 14:46:29 -06:00
Kris Nuttycombe f3c8b58784 Minor internal variable renaming for clarity. 2024-03-22 09:14:08 -06:00
Kris Nuttycombe cb218ad5ac
Merge pull request #1297 from nuttycom/sqlite_wallet/branching_chain_test_fixes
Fix update_chain_tip_unstable_max_scanned tests.
2024-03-21 12:08:37 -06:00
Kris Nuttycombe dc4fccf566 zcash_client_sqlite: Modify `TestState` to allow initialization with chain state. 2024-03-20 20:43:49 -06:00
Kris Nuttycombe 978f838aae zcash_client_sqlite: Add `testing::TestAccount` struct. 2024-03-20 10:08:36 -06:00
Jack Grigg 7bcf10b44b zcash_client_sqlite: Include Orchard receiver in default UA for new accounts 2024-03-20 00:28:40 +00:00
Jack Grigg 3090aff87f Distinguish seed relevance when no derived accounts are present
During wallet migration in particular, the absence of _any_ accounts is
expected, and all seeds should be treated as relevant (because accounts
cannot be added before a wallet is initialized).
2024-03-19 17:53:41 +00:00
Jack Grigg e6bc21b461 Add `WalletRead::is_seed_relevant_to_any_derived_accounts` 2024-03-19 00:34:28 +00:00
Jack Grigg c67b17dc96 zcash_client_sqlite: Extract `seed_matches_derived_account` helper 2024-03-19 00:34:28 +00:00
Kris Nuttycombe ab3e790bfc zcash_client_backend: Rename `AccountKind` to `AccountSource` 2024-03-15 09:28:35 -06:00
Kris Nuttycombe 46fd6ab0fe zcash_client_backend: Make `WalletRead::get_transaction` return `Result<Option<Transaction>, _>`
This should never have had the behavior of returning an error on a
missing txid in the first place; doing so conflates database corruption
or connectivity errors with the ordinary case where data may not be
available.
2024-03-14 17:38:51 -06:00
Kris Nuttycombe cc990b60e0 zcash_keys: Remove HdSeedFingerprint as it duplicates `zip32::fingerprint::SeedFingerprint` 2024-03-14 17:09:03 -06:00
Kris Nuttycombe 0bae47b05b zcash_client_backend: Improve API ergonomics for input selection. 2024-03-13 19:33:06 -06:00
Jack Grigg bbb7f36e55 zcash_client_backend: Add `WalletRead::get_account` 2024-03-13 21:00:59 +00:00
Jack Grigg 64aabdc54a Rename `WalletRead::get_seed_account` to `WalletRead::get_derived_account` 2024-03-13 21:00:59 +00:00
Jack Grigg 5f3d5e9f4a zcash_client_sqlite: Use `wallet::Account` for `WalletRead::Account` 2024-03-13 21:00:59 +00:00
Jack Grigg 65093487c3 zcash_client_backend: Expose the kind of an `Account` 2024-03-13 21:00:59 +00:00
Jack Grigg bc6aa955ff zcash_client_sqlite: Refactor `wallet::Account` to be a struct 2024-03-13 21:00:59 +00:00
Jack Grigg 634ebf51ef Reorder `WalletRead` and `WalletWrite` trait methods for clarity 2024-03-13 16:00:32 +00:00
Kris Nuttycombe f58263e211 zcash_client_backend: Require the tree state for the start of each scanned range.
In order to support constructing the anchor for multiple pools with a
common anchor height, we must be able to checkpoint each note commitment
tree (and consequently compute the root) at that height. Since we may
not have the information in the tree needed to do so, we require that it
be provided.

As a bonus, this change makes it possible to improve the UX around
spendability, because we will no longer require subtree ranges below
received notes to be fully scanned; the inserted frontier provides
sufficient information to make them spendable.
2024-03-12 18:14:11 -06:00
Kris Nuttycombe 33e943d14a zcash_client_backend: Add `WalletRead::get_seed_account` 2024-03-12 11:21:04 -06:00
Kris Nuttycombe 5e810d3689
Merge pull request #1258 from nuttycom/sqlite_wallet/fuzzy_key_matching
Return partial matches when using `WalletRead::get_account_for_ufvk`.
2024-03-12 11:12:34 -06:00
Kris Nuttycombe 09181f458c zcash_client_sqlite: Return a backend-specific `Account` type from get_account_by_ufvk. 2024-03-12 08:59:53 -06:00
Kris Nuttycombe a0bd257124 zcash_client_sqlite: Return partial matches when using `WalletRead::get_account_for_ufvk` 2024-03-12 08:59:53 -06:00
Jack Grigg d68a01a221 Fix typos 2024-03-11 19:00:26 +00:00
Jack Grigg 8e09b78ca1 zcash_client_sqlite: Call `mark_orchard_note_spent` in `WalletDb::store_sent_tx` 2024-03-11 18:58:09 +00:00
Kris Nuttycombe 021128b106 zcash_client_sqlite: Add Orchard note selection. 2024-03-11 18:58:09 +00:00
str4d 33be548f08
zcash_client_sqlite: Use preference order for z->t account matching
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-03-11 18:41:05 +00:00
Kris Nuttycombe 22ed9ebd35 zcash_client_sqlite: Ensure we identify the sending account in z->t transactions. 2024-03-11 17:49:44 +00:00
Kris Nuttycombe 8dfa836a03 zcash_client_sqlite: Use correct offsets for Orchard commitment positions. 2024-03-11 17:42:23 +00:00
Kris Nuttycombe b62763d689 zcash_client_sqlite: Add Orchard note commitments in `put_blocks` and `put_block` 2024-03-11 17:34:43 +00:00
Kris Nuttycombe 1181566401 zcash_client_sqlite: Support Orchard scanning 2024-03-11 17:31:04 +00:00
Kris Nuttycombe 50f5df4c1d zcash_client_sqlite: Implement `WalletDb::get_orchard_nullifiers` 2024-03-11 17:31:04 +00:00
Kris Nuttycombe af4dce9912 zcash_client_sqlite: Implement `wallet::orchard::put_received_note` 2024-03-11 17:31:04 +00:00
Kris Nuttycombe 374ed8cf94 zcash_client_sqlite: Add backend impl for the Orchard note commitment tree 2024-03-11 16:35:01 +00:00
Jack Grigg a0b517a93a zcash_client_sqlite: Add `OrchardPoolTester`, run tests with Orchard 2024-03-09 20:44:19 +00:00
Kris Nuttycombe e2ac746e9d zcash_client_sqlite: Generalize `ReceivedNoteId` 2024-03-08 16:43:06 -07:00
Kris Nuttycombe d55edd8dd8 zcash_client_sqlite: Deduplicate `WalletDb::get_sapling_nullifiers` 2024-03-08 16:41:51 -07:00
Kris Nuttycombe 7aacfc3bb0 zcash_client_sqlite: Extract general helpers from Sapling tree logic 2024-03-08 16:41:51 -07:00
Kris Nuttycombe 78e4916899 zcash_client_backend: Generalize `DecryptedOutput` to support Orchard 2024-03-08 13:48:30 -07:00
Kris Nuttycombe 4c5ce32dee zcash_client_backend: Use `NonNegativeAmount` for `select_spendable_notes` 2024-03-08 13:48:30 -07:00
Andrew Arnott 0c80893ce0 zcash_client_sqlite: Rework accounts to support imported viewing keys 2024-03-08 18:55:18 +00:00
Kris Nuttycombe 5675a76f0d zcash_protocol: Use `BalanceError` instead of `()` for monetary range violations. 2024-03-05 13:59:26 -07:00