Commit Graph

98 Commits

Author SHA1 Message Date
Kris Nuttycombe f7a3b9bda3
Merge pull request #661 from nuttycom/wallet/spend_with_usk
Use unified spending keys for spends & shielding.
2022-10-12 12:15:34 -06:00
Kris Nuttycombe 3c837381db Disallow invalid pool/address combinations with `Recipient`. 2022-10-11 12:52:44 -06:00
Kris Nuttycombe 56b2edd498 Simplify sqlite backend storage for sent notes & utxos.
The currently deprecated implementations of `insert_sent_utxo`,
`insert_sent_note`, `put_sent_utxo` and `put_sent_note` all store to the
same `sent_notes` table internally. Since there's no immediate plan to
change this arrangement, it's better to have a single pair of internal
`insert_sent_output` and `put_sent_output` methods instead.
2022-10-11 08:57:44 -06:00
Kris Nuttycombe 06e43a572a Track inputs sent to wallet-internal recipients.
Ensure that we're attempting trial-decryption with the internal IVK
and correctly track internal vs. external recipients in the wallet
database.
2022-10-11 08:56:22 -06:00
str4d 1dc3cfe724
Merge pull request #657 from nuttycom/wallet/upsert_utxos
Use upsert functionality for transparent UTXOs, rather than delete/repopulate.
2022-10-11 04:17:49 +01:00
Kris Nuttycombe c5b9219f00 Look up the account by the UFVK corresponding to the USK when spending. 2022-10-05 14:35:51 -06:00
Kris Nuttycombe e9406201d5
Merge pull request #663 from nuttycom/sapling_key_cleanup
Fix Sapling key organization.
2022-10-05 14:35:16 -06:00
Kris Nuttycombe 6df6fec860 Add utxo received_by_account data to WalletTransparentOutput
Also, this removes wallet::delete_utxos_above.
2022-10-04 13:34:52 -06:00
Kris Nuttycombe 14787f574f Add a migration to add account ID to the utxos table. 2022-10-04 12:25:56 -06:00
Kris Nuttycombe 60785a1d7a Fix Sapling key organization.
This change moves Sapling-specific key generation into a
submodule of `zip32`. Public reexports are used to keep the
existing API consistent.
2022-10-03 20:28:04 -06:00
Kris Nuttycombe f7aa7b2c84 Upgrade rusqlite to version 0.25 2022-10-03 08:12:37 -06:00
Jack Grigg e54e3f21e8 zcash_client_sqlite: Remove direct ff dependency 2022-10-02 23:16:44 +01:00
Kris Nuttycombe 2c16f78fee zcash_client_sqlite: fix wallet::get_max_account_id
This had the same bug as was fixed in 5b8ec380a0
2022-09-26 16:48:58 -06:00
Kris Nuttycombe 03c3370de8 Fix problems identified by clippy's beta lints 2022-09-17 08:57:37 -06:00
Kris Nuttycombe d0062a87d4 Add WalletWrite::create_account function 2022-09-13 18:58:28 -06:00
Kris Nuttycombe b5908dc964
Merge pull request #632 from nuttycom/data_api/get_next_address
Replace `get_address` with `get_current_address` and `get_next_available_address`
2022-09-12 18:43:38 -06:00
Kris Nuttycombe 03b0ff7e0a Replace `get_address` with `get_current_address` and `get_next_available_address`
This updates the data access API to provide diversified address
functionality. In order to support this change, the addresses table
is updated to store diversifier index information in big-endian order
to allow sorting by diversifier index, and account initialization
is updated to store the diversifier index accordingly. The currently
unreleased `addresses_table` migration is updated to reflect this
change.
2022-09-12 17:58:22 -06:00
Kris Nuttycombe 95610f7b4f Add fee to the transactions table & compute correct net_value in v_transactions. 2022-09-09 16:12:29 -06:00
Jack Grigg 7112ed9da5 zcash_client_backend: Add `WalletReadTransparent::get_transparent_receivers`
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-09-08 20:24:42 +00:00
Jack Grigg 154ef077b4 zcash_client_sqlite: Move address data to an `addresses` table
Closes zcash/librustzcash#489.
2022-09-08 18:50:18 +00:00
Jack Grigg 7d404d2747 zcash_client_sqlite: Fix `WalletRead::get_address` return value
Previously it would return an error if the account identifier did not
correspond to a known account.
2022-09-08 18:49:41 +00:00
Jack Grigg a32714043b zcash_client_backend: Change `WalletRead::get_address` to return UA 2022-09-08 18:49:13 +00:00
Jack Grigg 12e8c53310 zcash_client_sqlite: Add statement helper methods to `DataConnStmtCache`
These methods provide type-safe ways to interact with the prepared
statements.
2022-08-29 19:25:36 +00:00
Kris Nuttycombe 913d572087 Allow the seed to be an optional argument to database init.
This adds a new `WalletMigrationError` type so that we have
a good place to report whether or not the seed is required.
2022-08-18 16:03:20 -06:00
Kris Nuttycombe e9db8d5b01 Use `secrecy` when handling seed phrases in migrations code. 2022-08-18 10:15:58 -06:00
Kris Nuttycombe cdfaa57496 Add migrations to support using UFVKs instead of Sapling extfvks.
Fixes #594
2022-08-18 10:15:58 -06:00
Kris Nuttycombe 7c5b320108 Introduce wallet database schema migrations.
This replaces the current wallet initialization code with a migration
that brings the database up to the state produced by release 0.3.0.
A subsequent commit will add migrations that correctly produce the
database state as of zcash/librustzcash@602270cb1f.

Fixes #369
2022-08-18 10:15:58 -06:00
Jack Grigg 76d015ed11 zcash_client_backend: Fix `UnifiedFullViewingKey` Sapling item type
Per ZIP 316, the Sapling FVK Encoding only includes `(ak, nk, ovk, dk)`
which is a subset of the Sapling `ExtendedFullViewingKey`. We therefore
need to use `DiversifiableFullViewingKey` inside `UnifiedFullViewingKey`
in order to make it parseable from the UFVK string encoding.

`zcash_client_sqlite::wallet::get_extended_full_viewing_keys` has been
removed as a consequence of this change: we can no longer reconstruct
the correct `ExtendedFullViewingKey` from the `UnifiedFullViewingKey`.
2022-06-17 10:03:17 +00:00
Jack Grigg d8b860207d zcash_client_backend: Remove account from `UnifiedFullViewingKey`
The account number is not stored in the ZIP 316 UFVK encoding, and in
general won't necessarily be known (e.g. if a UFVK is being imported
into a wallet).

`zcash_client_sqlite::wallet::init::init_accounts_table` reverts to its
previous behaviour of requiring the provided `&[UnifiedFullViewingKey]`
to be indexed by account number.
2022-06-17 10:03:17 +00:00
Jack Grigg c0e8ee0fa0 zcash_client_backend: Return UFVKs from `WalletRead` instead of ExtFVKs 2022-06-17 10:03:17 +00:00
Jack Grigg 0d0527dbf3 zcash_client_sqlite: Store UFVK/UA instead of Sapling ExtFVK/address
This is a breaking change to the database format. We don't have support
for migrations yet, so existing wallets won't work after this commit
until zcash/librustzcash#489 is done.
2022-06-14 02:18:25 +00:00
Kris Nuttycombe e20de50b84 Make AccountId internal representation private. 2022-02-10 11:30:02 -07:00
Kris Nuttycombe a304c3953b Fix Clippy beta linting complaints. 2022-02-02 16:02:45 -07:00
Kris Nuttycombe 488d13fde3 Do not delete sent note data in rewind. 2022-02-02 12:48:22 -07:00
Kris Nuttycombe 9c2d485c80 Address comments from code review.
Co-authored-by: str4d <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-02-02 10:33:41 -07:00
Kris Nuttycombe 3d51c53d68 Address comments from code review.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-02-02 10:32:33 -07:00
Kris Nuttycombe 5a75c210f0 Fix order of note deletion relative to transactions being un-mined in rewind. 2022-02-02 10:30:07 -07:00
Kris Nuttycombe e8e5d94ea6 Mark functions that will be made crate-private as deprecated 2022-02-02 10:29:19 -07:00
Kris Nuttycombe 47fc12704b Fix doctest compilation. 2022-01-25 10:01:48 -07:00
Kris Nuttycombe f58d191439 Move transparent account keys to zcash_primitives. 2022-01-25 08:53:51 -07:00
Kris Nuttycombe 37e6d3a2bc Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: ying tong <yingtong@z.cash>
2022-01-20 16:43:57 -07:00
Kris Nuttycombe cc58a21ad7 Feature-flag transparent functionality in zcash_client_sqlite
This fixes the wasm32-wasi build issues by excluding the
hdwallet dependencies which are not wasm32-wasi compatible.
2021-10-04 16:53:55 -06:00
Kris Nuttycombe d49a20e6d2 Modify WalletTransparentOutput to wrap TxOut directly. 2021-10-01 11:42:04 -06:00
Kris Nuttycombe db89569b90 Address documentation & naming requests from code review. 2021-10-01 11:03:09 -06:00
Kris Nuttycombe 2053d7f57b Always take number of confirmations as a parameter. 2021-10-01 11:00:50 -06:00
Kris Nuttycombe b783c4d0e7 Merge remote-tracking branch 'upstream/master' into autoshield-poc-daa 2021-08-12 11:21:30 -06:00
Kris Nuttycombe 55d1090f70 Add v5 txid & signature hashing. 2021-06-04 15:45:39 -06:00
Kris Nuttycombe 76999eb5c7 Make txid contents private & use txid for TzeOutPoint 2021-06-01 07:03:31 -06:00
Kevin Gorham 74434f370c
Fix: get rewind height when there are no unspent notes.
Previously, this function was not properly returning an optional.
2021-04-22 16:26:57 -04:00
Kevin Gorham 7fc2d9725c
Placeholder commit: just get things working.
Clean up later but for now don't allow nullable accountIds and also delete more data, during a rewind.
2021-04-20 10:13:47 -04:00