Commit Graph

15221 Commits

Author SHA1 Message Date
Kris Nuttycombe df51fc8761 Remove unused account-related wallet methods. 2021-08-12 08:07:12 -06:00
John Newbery 8af7e138ac [wallet] Kill accounts
This commit does the following changes:

- [wallet] Remove 'account' argument from GetLegacyBalance()
  - GetLegacyBalance() is never called with an account argument.
    Remove the argument and helper functions.
- [wallet] Remove CWallet::ListAccountCreditDebit()
  - Function no longer used.
- [wallet] Remove AccountMove()
  - Function no longer used.
- [wallet] Remove AddAccountingEntry()
  - Function no longer used.
- [wallet] Remove GetAccountCreditDebit()
  - Function no longer used.
- [wallet] Don't rewrite accounting entries when reordering wallet transactions.
 - Accounting entries are deprecated. Don't rewrite them to the wallet
   database when re-ordering transactions.
- [wallet] Remove WriteAccountingEntry()
  - Function no longer used.
- [wallet] Don't read acentry key-values from wallet on load.
- [wallet] Remove ListAccountCreditDebit()
  - Function no longer used.
- [wallet] Remove CAccountingEntry class
  - No longer used
- [wallet] Remove GetLabelDestination
  - Function no longer used.
- [wallet] Delete unused account functions
  - ReadAccount
  - WriteAccount
  - EraseAccount
  - DeleteLabel
- [wallet] Remove fromAccount argument from CommitTransaction()
- [wallet] Remove strFromAccount.
  - No longer used.
- [wallet] Remove strSentAccount from GetAmounts().
  - No longer used.
- [wallet] Update zapwallettxes comment to remove accounts.
- [wallet] Remove CAccount
  - No longer used
- [docs] fix typo in release notes for PR 14023

(cherry picked from commit c9c32e6b844fc79467b7e24c6c916142a0d08484)
2021-08-12 08:07:12 -06:00
John Newbery 3ef50b3647 [wallet] Remove wallet account RPCs
Also remove the RPC deprecation tests for accounts, and make one small
change to another wallet test that relies on account behaviour.

(cherry picked from commit f0dc850bf698f7377797d7d68365d4fc79b0221c)
2021-08-12 08:07:12 -06:00
John Newbery 0bf8b56b29 [RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts.
(cherry picked from commit 702ae1e21a09d8c31406839c4ea507c5fa276898)
2021-08-11 19:36:14 -06:00
John Newbery 5dd21ca625 [wallet] GetBalance can take a min_depth argument.
(cherry picked from commit cf15761f6d4526d205126fbf5f088ac8edebeb57)
2021-08-11 17:07:30 -06:00
John Newbery 55f95b12d7 [wallet] factor out GetAvailableWatchOnlyBalance()
(cherry picked from commit 0f3d6e9ab75837ead3acfda342aa3ea404efb81d)
2021-08-11 17:07:30 -06:00
John Newbery f1aecdb9b2 [wallet] deduplicate GetAvailableCredit logic
(cherry picked from commit 7110c830f8c5de3570178bf4e5d28fe3e4f109e1)
2021-08-11 17:07:30 -06:00
John Newbery 5fc98a3b34 [wallet] Factor out GetWatchOnlyBalance()
Zcash: removes GetWatchOnlyBalance (unused)

(cherry picked from commit ef7bc8893c7a953953aa457736d79c28a4f45792)
2021-08-11 17:07:30 -06:00
John Newbery f7c57ecca4 [wallet] GetBalance can take an isminefilter filter.
GetBalance() can now take an ismine filter, which is passed down to
GetAvailableCredit. This allows GetBalance to be used to get watch-only
balances.

(cherry picked from commit 4279da47855ec776f8d57c6579fe89afc9cbe8c1)
2021-08-11 17:07:30 -06:00
Russell Yanofsky 65c0c0b232 [wallet] Remove unneeded legacy getbalance code
(cherry picked from commit 02d9f50d5f3c96fe888c230d59c5afdab4c7c6a3)
2021-08-11 17:07:27 -06:00
Russell Yanofsky 35950132aa [wallet] Add GetLegacyBalance method to simplify getbalance RPC
This adds a simpler new implementation of getbalance logic along with asserts
to confirm it behaves identically to the old logic. The old logic is removed in
the next commit.

(cherry picked from commit 82b7dc373afff277d3083d09e68c6b69778f312f)
2021-08-10 14:19:15 -06:00
Patrick Strateman 6edda25d9c Move GetAccountBalance from rpcwallet.cpp into CWallet::GetAccountBalance
(cherry picked from commit ecb9741ec3067f67f595126869d0200c62064bbd)
2021-08-10 14:19:15 -06:00
John Newbery f03ce68a61 [tests] Remove wallet accounts test
The accounts API will be removed in the next commit. Remove all
functional tests for the accounts API.

(cherry picked from commit c410f415758913c933ad6c71cf50227cc85aa385)
2021-08-10 14:19:15 -06:00
Patrick Strateman 97023ea0b8 Move CWalletDB::ReorderTransactions to CWallet
(cherry picked from commit 86029e72c96436605f47153c1f09e151e1847c28)
2021-08-10 14:19:15 -06:00
Luke Dashjr 31d49b09b7 Optimisation: Store transaction list order in memory rather than compute it every need
Huge performance improvement (450%) for zapwallettxes

(cherry picked from commit 3e7c89196ceb2742b62cd183d6fab74edc40647a)
2021-08-10 14:19:15 -06:00
Patrick Strateman a113057ab9 Add CWallet::ReorderTransactions and use in accounting_tests.cpp
(cherry picked from commit d2e678d7d220e2f430c2cb4bde559acee00c8c7c)
2021-08-10 14:19:15 -06:00
Patrick Strateman 9dc4e4b0aa Add CWallet::ListAccountCreditDebit
Simple pass through for CWalletDB::ListAccountCreditDebit

(cherry picked from commit 59adc86680911a83dcccf5b23db299a370fc92f2)
2021-08-10 14:19:15 -06:00
Patrick Strateman 33568f64bd Fix insanity of CWalletDB::WriteTx and CWalletTx::WriteToDisk
(cherry picked from commit 0fd599767d2dabf25ac8c3543cb586cfc4b9d816)
2021-08-10 14:19:15 -06:00
Homu 1cb1ed2653 Auto merge of #5265 - str4d:zip-239-prep-1, r=str4d
ZIP 239 preparations 1

This is the first of several backports to prepare for ZIP 239. The primary
change is altering `mapRelay` to store `CTransaction`s, which we need
because ZIP 239 requires changing `Inv` messages based on transaction
versions. The other changes are mainly for conflict removal but are also
independently useful.

Backports the following upstream PRs:
- bitcoin/bitcoin#6889
- bitcoin/bitcoin#7125
- bitcoin/bitcoin#7862
- bitcoin/bitcoin#7877
2021-08-10 00:22:32 +00:00
Homu f721e3b067 Auto merge of #5268 - str4d:optimise-reindex, r=str4d
Optimise reindex

Backports https://github.com/bitcoin/bitcoin/pull/7917:

> Several changes:
>
> * Make reindex/import use `AcceptBlock` rather than `ProcessNewBlock`,
>   so activation of the resulting best chain is delayed.
>
> * That delayed activation is handled by the existing "Activating best
>   chain" step in the startup process, which is moved to `ThreadImport`.
>
> * Optimize `ActivateBestChain` to not walk the entire chain to find the
>   most work chain to connect for each block (O(n^2) -> O(n)).
>
> This has several advantages:
>
> * As the actual activation is done after all blocks have been added
>   back to the index, it gets to use the checkpoints information (better
>   progress indicator, skipping of signature checks, ...).
>
> * Having a block index with many unactivated blocks (for example, after
>   deleting the chainstate directory) becomes _much_ faster
>
> * That case also runs in the background now (as it's simply treated as
>   part of the importing process).
>
> Downsides:
>
> * All blocks are read twice from disk during reindex (once to rebuild
>   the index, once to activate).
2021-08-09 22:54:27 +00:00
Jack Grigg 01f66cd00a test: Flush wallet in WriteCryptedSaplingZkeyDirectToDb before reopening
Hopefully this should reliably prevent the race condition we see in CI.
2021-08-09 23:53:14 +01:00
Jack Grigg c173a26a2d Revert "Remove reference to -reindex-chainstate"
This reverts commit f42cde3c30.
2021-08-09 20:58:49 +01:00
Pieter Wuille d3ccecd0b9 Report reindexing progress in GUI
(cherry picked from commit b4d24e142e25a21c78ab74146c3520f2259fd7c2)

Zcash: Excludes GUI changes (as we don't have the QT GUI).
2021-08-09 20:58:49 +01:00
Pieter Wuille d6d39449e5 Add -reindex-chainstate that does not rebuild block index
(cherry picked from commit d3d75479115bc3480f163df774ee9dd2f8bd9f54)
2021-08-09 20:58:49 +01:00
Pieter Wuille dcd0ba8059 Optimize ActivateBestChain for long chains
(cherry picked from commit fb8fad1586ced69fa37c665a11916ae4c4d0df05)
2021-08-09 20:58:49 +01:00
Pieter Wuille e967b56fbe Switch reindexing to AcceptBlock in-loop and ActivateBestChain afterwards
(cherry picked from commit 316623f2c197971db9b5bcb9c84e446254b552c3)
2021-08-09 20:58:49 +01:00
Pieter Wuille eb0df5d324 Make ProcessNewBlock dbp const and update comment
(cherry picked from commit d253ec4baa21cc292cf72d453f71b4043b53e591)
2021-08-09 20:58:49 +01:00
Jack Grigg 75b9fc4f27 test: Fix race condition in p2p_txexpiringsoon
The recent changes to mempool inv logic mean that nodes are much less
likely to immediately return an `inv` message in response to a `mempool`
message. The `p2p_txexpiringsoon` RPC test was relying on the prior
behaviour.

`TestNode.sync_with_ping` now takes an optional `waiting_for` closure
that allows the caller to require that a specific message kind is
received prior to the timeout.
2021-08-09 17:43:48 +01:00
Jack Grigg 6be1a2a9da test: Wait for transaction propagation in shorter_block_times RPC test
This was previously a transient test failure, that started reliably
failing after the move to Poisson delays.
2021-08-05 20:54:47 +01:00
Daira Hopwood 465c2492e7
More precise terminology: "lock free" -> "unlocked" 2021-08-05 14:19:51 +01:00
Pieter Wuille ad8abd68a1 Change mapRelay to store CTransactions
(cherry picked from commit 38c310299cfef419d42744362b90c1700b598953)
2021-08-04 17:12:36 +01:00
Suhas Daftuar 44787c0179 Use txid as key in mapAlreadyAskedFor
Previously we used the CInv that would be sent to the peer announcing the
transaction as the key, but using the txid instead allows us to decouple the
p2p layer from the application logic (which relies on this map to avoid
duplicate tx requests).

(cherry picked from commit 7e91f632c70ff1848a152f24ee67a06796803943)
2021-08-04 17:12:36 +01:00
Pieter Wuille 13d8f294ac Replace trickle nodes with per-node/message Poisson delays
We used to have a trickle node, a node which was chosen in each iteration of
the send loop that was privileged and allowed to send out queued up non-time
critical messages. Since the removal of the fixed sleeps in the network code,
this resulted in fast and attackable treatment of such broadcasts.

This pull request changes the 3 remaining trickle use cases by random delays:
* Local address broadcast (while also removing the the wiping of the seen filter)
* Address relay
* Inv relay (for transactions; blocks are always relayed immediately)

The code is based on older commits by Patrick Strateman.

(cherry picked from commit 5400ef6bcb9d243b2b21697775aa6491115420f3)
2021-08-04 17:12:25 +01:00
Jonas Schnelli ae9768c8b7 fix locking issue with new mempool limiting
Current master crashes on OSX with an exception: "boost: mutex lock failed in pthread_mutex_lock: Invalid argument"

(cherry picked from commit 0d699fc821048ab9316b0004e6552c8f1dc5e5f4)

Zcash: Also adds the `clear` call that this was fixing. Upstream added it
in https://github.com/bitcoin/bitcoin/pull/6722 which we never backported
(instead implementing our own mempool limiting logic).
2021-08-04 17:12:25 +01:00
Homu 2c90f7ea9d Auto merge of #5247 - nuttycom:consensus/action_flag_consistency, r=str4d
Add check for consistency between nActionsOrchard and Orchard flags.

Fixes #5245
2021-08-04 10:48:33 +00:00
Homu b67ffbb958 Auto merge of #5262 - str4d:bump-deps-4.5.0, r=str4d
Update dependencies

We now build with Rust 1.54 and Clang / libc++ 12.
2021-07-31 01:15:52 +00:00
str4d bdaf3e1ab2 depends: Greatly simplify the Clang 12 patch
We can avoid the "%s" optimization with "%s%s" :D

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-30 19:53:18 +01:00
Jack Grigg 5bb339824d cargo fmt 2021-07-30 19:08:18 +01:00
Jack Grigg 73a33efa43 CI: Use Rust 1.54 for lints 2021-07-30 18:36:42 +01:00
Jack Grigg 5ace59b38f rust: metrics 0.17 2021-07-30 18:22:05 +01:00
Jack Grigg 6e2a5b3f92 rust: cargo update 2021-07-30 18:22:05 +01:00
Jack Grigg 18e39ff9f0 depends: Fix issue cross-compiling BDB to Windows with Clang 12 2021-07-30 18:22:05 +01:00
Jack Grigg d9bcc2d303 depends: Update utfcpp to 3.2.1 2021-07-30 18:22:05 +01:00
Jack Grigg 374f60b326 depends: Update Clang / libcxx to LLVM 12
This is the second release in a row where LLVM has cut a X.0.1 for
everything except Darwin, so I've adjusted its URLs and paths on the
assumption this will continue.
2021-07-30 18:22:05 +01:00
Jack Grigg 0a5e69ab67 depends: Update Rust to 1.54.0 2021-07-30 18:22:05 +01:00
Kris Nuttycombe 660686d412 Fix error strings to correctly reflect context. 2021-07-30 11:16:22 -06:00
Kris Nuttycombe 8a904c0a8b
Use DOS level 100 for noncontextual checks.
Co-authored-by: str4d <jack@electriccoin.co>
2021-07-30 11:14:28 -06:00
Jack Grigg 1eb848ada2 Postpone dependency updates we aren't doing in this release 2021-07-30 16:04:31 +01:00
Homu 82a50f6c53 Auto merge of #5252 - str4d:ua-encoding, r=str4d
Unified Address encoding and decoding

Closes zcash/zcash#5133.
2021-07-30 00:40:08 +00:00
str4d 037bfa32f3 Track lengths when copying receiver data from C++ to Rust
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-30 01:38:38 +01:00