Commit Graph

16333 Commits

Author SHA1 Message Date
Kris Nuttycombe 4eda33f184 Serialize the Orchard note commitment tree to the wallet.
This adds serialization of Orchard note commitment trees
to `SetBestChain` and deserialization and loading of those
trees to wallet load.
2022-03-11 22:47:37 -07:00
Kris Nuttycombe 30dd633de6 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-11 22:39:06 -07:00
Kris Nuttycombe 5d17e53c5c Address suggestions from code review on #5637 2022-03-11 22:39:06 -07:00
Kris Nuttycombe f5b23b3336 Modify `join_network` in tests to skip mempool resync.
Prior to this change, calling `join_network` after a network split
only worked in the case that no new non-coinbase transactions were
created during the network partition; in the case that such a
transaction was created, `join_network` would fail when waiting
for mempool synchronization, because zcashd nodes do not.
automatically broadcast their mempool contents on restart.

This change modifies `setup_network` to wait for mempool synchronization
or not on the basis of a newly added do_mempool_sync flag. In the
case of `join_network`, this flag is set to `False`; the default value
is set to `True` to preserve previous functionality elsewhere.

Tests should explicitly use the `resendwallettransactions` RPC method
to ensure that mempool transactions are rebroadcast before attempting
to synchronize the network after a `join_network` call.
2022-03-11 22:39:06 -07:00
Kris Nuttycombe 1e1521f101 Ensure that Orchard spentness information is repopulated by LoadUnifiedCaches. 2022-03-11 22:39:06 -07:00
str4d 0f59c5b926
Merge pull request #5658 from str4d/5570-tx-builder-orchard-spends
Add Orchard sender support to the transaction builder
2022-03-12 04:33:06 +00:00
therealyingtong 3c0e1d9aa8 CWallet::GetConflictS: Handle conflicting Orchard spends.
Co-authored by: Kris Nuttycombe <kris@nutty.land>
2022-03-11 19:30:52 -07:00
Kris Nuttycombe 0c38ad9200 Return std::optional<CExtKey> from CExtKey::Master
Master key generation is fallible, but the type of master
key generation did not previously reflect that the generated
key might be invalid.
2022-03-11 18:47:01 -07:00
Jack Grigg 93797d185b Improve FFI interface documentation
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-12 01:33:39 +00:00
Daira Hopwood 577f695af5 Set `meta` for `-datadir` option.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 19:02:31 +00:00
Daira Hopwood 3e36252d9a Document that '~' cannot be used in `-datadir` (see #5661).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 18:35:52 +00:00
Daira Hopwood d5b6e226f0 Ensure the buffer used in `prompt` is zeroized even on error.
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 18:21:11 +00:00
Daira Hopwood 7a98644ff2 Improve error message when the config file cannot be found, taking into account -conf and -datadir.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 18:16:40 +00:00
Daira Hopwood cb2c89eedf Use the tracing crate for debugging.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 17:17:56 +00:00
Jack Grigg 7921ef1c55 wallet: Alter `OrchardWallet::GetSpendInfo` to return the spending key
In the context of `z_sendmany`, we will need both the spending key and
note spendInfo as a pair, so it makes sense to fetch those together.
2022-03-11 03:31:00 +00:00
Jack Grigg 6a7213b5d5 Add Orchard spend support to the transaction builder
Closes zcash/zcash#5570.
2022-03-11 03:30:55 +00:00
str4d 8964763bef
Merge pull request #5653 from nuttycom/feature/wallet_orchard-merge_master
Merge master branch back to `feature/wallet_orchard`
2022-03-11 03:19:18 +00:00
Daira Hopwood f6a8461047
Merge pull request #5636 from superbaud/lazy-load-parameters
only load the proof parameters in gtests for tests that need them
2022-03-10 18:11:09 +00:00
Daira Hopwood 799b46b90a Cleanups to error handling for the first invocation of zcash-cli.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-10 17:18:26 +00:00
Daira Hopwood 999b395360 Improve memory hygiene, and use -stdin to pass the recovery phrase to the child zcash-cli process.
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-10 17:17:06 +00:00
Kris Nuttycombe 880cbe0dc4
Merge pull request #5647 from therealyingtong/orchard-nullifier-test
Update `coins_tests.cpp` to test Orchard cases.
2022-03-10 06:59:19 -07:00
Kris Nuttycombe 8bf99eaacc Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard-merge_master 2022-03-09 22:17:49 -07:00
Kris Nuttycombe b21ca34d44
Merge pull request #5637 from nuttycom/feature/wallet_orchard-persist_action_ivks
Implement Orchard note persistence & restore.
2022-03-09 22:13:26 -07:00
Kris Nuttycombe f057ebb375 Apply suggestions from code review 2022-03-09 17:48:27 -07:00
Kris Nuttycombe e63d52896a Restore mined block heights when restoring decrypted notes. 2022-03-09 17:48:27 -07:00
Kris Nuttycombe ca34a97a37 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-09 13:26:10 -07:00
Daira Hopwood d4405feddf Simplify extraction of recovery phrase.
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-09 18:04:27 +00:00
Kris Nuttycombe 98ee3bd733 Update tests with rollback checks. 2022-03-09 09:26:37 -07:00
Kris Nuttycombe dc1609094d Restore decrypted notes to the wallet. 2022-03-09 09:26:37 -07:00
Kris Nuttycombe 0149451217 Persist Orchard action index/IVK mappings in CWalletTx 2022-03-09 09:26:37 -07:00
Kris Nuttycombe ecd0d24baa Update walletTx with decrypted Orchard action metadata. 2022-03-09 09:26:37 -07:00
Kris Nuttycombe 46c33c68e0
Merge pull request #5642 from nuttycom/feature/wallet_orchard-fix_confirmations
Set number of confirmations & respect maxDepth in Orchard note selection.
2022-03-09 07:58:27 -07:00
therealyingtong 26b8ec5562 coins_tests: Update tests to include Orchard case.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-03-09 22:52:39 +08:00
therealyingtong 663f8d434a coins_tests.cpp: Add Orchard nullifier to TxWithNullifiers().
Closes zcash/zcash#5240

Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-03-09 22:20:46 +08:00
Kris Nuttycombe 38f4afa80c Set number of confirmations for Orchard notes returned by FindSpendableInputs 2022-03-08 22:03:24 -07:00
Kris Nuttycombe 3b5fc4e583 Respect maxDepth for Orchard notes in GetFilteredNotes 2022-03-08 22:00:30 -07:00
sasha ced825edec
Merge pull request #5587 from nuttycom/feature/wallet_orchard-record_spends 2022-03-08 18:38:47 -08:00
Kris Nuttycombe 19ce19155c Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-08 16:27:06 -07:00
Kris Nuttycombe 9284c5552b Track mined-ness instead of spent-ness of notes in the Orchard wallet.
Tracking spentness would require the Orchard wallet to be aware of the
local node's mempool contents; instead, the Orchard wallet now only
tracks whether a note is known to be mined and the C++ wallet checks
selected notes to determine whether any transactions that consume those
notes exist in the mempool.

In addition:
* Locking of notes will be delegated to the C++ side.
* The type of the recipient in wallet::NoteMetadata was
  changed from `*const Address` to `*mut Address` to reflect the
  fact that it is owned memory that must be freed.
* Nullifier data is no longer cleared during rewinds.
2022-03-08 11:55:53 -07:00
str4d 7129827509
Merge pull request #5601 from str4d/feature/wallet_orchard-shielded_coinbase
Select Orchard receivers from UA miner addresses once NU5 activates
2022-03-08 15:32:32 +00:00
Kris Nuttycombe 51cb37e541 Fix missing update to `last_checkpoint` on rewind. 2022-03-07 22:02:19 -07:00
Charlie O'Keefe 4f04c96f7b
Merge pull request #5632 from steven-ecc/z_sendmany_uniqueness_check
Extend uniqueness check in z_sendmany to UA receivers
2022-03-07 21:56:49 -07:00
Kris Nuttycombe c3cf141936 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-07 19:11:43 -07:00
Kris Nuttycombe c9ef5cd45a Add an `InPoint` type to the Orchard wallet to fix incorrect conflict data. 2022-03-07 19:05:00 -07:00
Kris Nuttycombe 97895a6f6d Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-07 19:05:00 -07:00
Kris Nuttycombe faffe2e084 Assert we never attempt to checkpoint the Orchard wallet at a negative block height.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-07 19:05:00 -07:00
Kris Nuttycombe 6171f27b02 Add a test for Orchard note detection.
We can't actually test rollback via RPC tests until
wallet persistence is implemented. This implements
a rollback scenario that will should pass after wallet
persistence is implemented.
2022-03-07 19:05:00 -07:00
Kris Nuttycombe 9336c5e7f0 Remove assertions that require Orchard wallet persistence to satisfy. 2022-03-07 19:05:00 -07:00
Kris Nuttycombe 23a7314607 Check wallet latest anchor against hashFinalOrchardRoot in ChainTip.
This will cause test failures until note commitment tree persistence
is implemented.
2022-03-07 19:05:00 -07:00
Kris Nuttycombe 6b8ecc8a31 Reset Orchard wallet state when rescanning from below NU5 activation. 2022-03-07 19:05:00 -07:00