Commit Graph

1212 Commits

Author SHA1 Message Date
Greg Pfeil d0522df5c0
Many z_mergetoaddress updates
- add ZIP 317 support
- address review comments
- restructure `AsyncRPCOperation_mergetoaddress` (removing the just-added
  `prepare`)
2023-04-20 01:24:39 -06:00
Greg Pfeil 94f5bfc595
Update z_mergetoaddress to use WalletTxBuilder
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-authored-by: Jack Grigg <jack@z.cash>
2023-04-19 22:26:42 -06:00
Daira Emma Hopwood 11dc0d7277 Add a `-blockunpaidactionlimit` config option to configure the per-block
limit on unpaid actions for ZIP 317 block template construction.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-20 00:48:38 +01:00
Daira Emma Hopwood c1930170d2 Remove the implementation of score-based block template construction
and the `-blockminsize` option.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-19 22:48:46 +01:00
Daira Emma Hopwood 783bd52556 mergetoaddress_helper.py: use Decimal for amounts and integers otherwise.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-19 22:48:46 +01:00
Daira Emma Hopwood 7c956ffab6 mergetoaddress_helper.py: Use `generate_and_check` helper to mine a block
and make sure that it contains the expected number of transactions.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-19 22:48:46 +01:00
Daira Emma Hopwood eb74c8e8b0 Repair some RPC tests.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-19 22:48:46 +01:00
Greg Pfeil e3b1802637
Don’t test “Insufficient funds” for `z_shieldcoinbase`
I don’t think it’s possible for this error condition to be tested for `z_shieldcoinbase` any more

1. to hit this failure, we need a fee higher than the amount available in coinbase UTXOs;
2. if there are no UTXOs to shield, we fail before reaching an “insufficient funds” check;
3. coinbase UTXOs are >1 ZEC, which is the highest we can set `-maxtxfee` to without emitting a
   warning;
4. emitting a warning causes the test to fail.
2023-04-18 19:39:47 -06:00
Greg Pfeil f655f482ab
WalletTxBuilder support for net payments
Previously, `WalletTxBuilder` expected a vector of payments with known amounts.
This meant that operations like `z_shieldcoinbase` and `z_mergetoaddress` needed
to pre-calculate the amount to be sent to the target address.

With ZIP 317 fees, this became harder to do. Now `WalletTxBuilder` accepts
either a vector of payments or a single address (and optional memo) for the net
amount to be paid to.

This also converts `z_shieldcoinbase` to use this approach. `z_mergetoaddress`
conversion is blocked by #6569.
2023-04-18 15:55:21 -06:00
str4d f512291ff2
Merge pull request #6555 from sellout/zip-317-legacy-wallet
Support ZIP 317 fees for legacy wallet operations
2023-04-18 20:44:46 +01:00
Kris Nuttycombe 0a47f1c148 Use the conventional fee for prioritisation in prioritisetransactions.py
Co-authored-by: Greg Pfeil <greg@technomadic.org>
2023-04-18 12:37:04 -06:00
Jack Grigg b3e40d8548 test: Sync blocks before invalidating them in `mempool_packages` RPC test
This avoids a race condition where node 1 attempts to fetch the block
while it is considered invalid by node 0, which eventually leads to the
nodes becoming disconnected, preventing the test from advancing.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-04-18 18:24:15 +00:00
Jack Grigg 8342e350b1 test: Avoid generating a chain fork in `mempool_packages` RPC test
There was a race condition here between the block generated by node 0
being broadcast to node 1, and being invalidated by node 0. Due to the
changes we made to the difficulty adjustment algorithm, the invalidated
block and the block replacing it generated by node 0 would have the same
chain work; thus if node 1 observed the invalidated block, it would
never reorg to the replacement block.

We fix this by having node 0 reconsider the invalidated block before
generating its next block. This avoids the chain fork, and also clears
the mempool to provide better separation between test stages.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-04-18 17:00:54 +00:00
Greg Pfeil bf68d69439 Remove `-txconfirmtarget` config option 2023-04-18 07:51:17 -06:00
Greg Pfeil 3f9714aa9d Address review comments re: legacy wallet ZIP 317 2023-04-18 07:51:17 -06:00
Greg Pfeil 59b98d8290 Remove `-mintxfee` config option 2023-04-18 07:51:16 -06:00
Kris Nuttycombe facb4856ee
Merge pull request #6568 from sellout/wallet_tx_builder-z_shieldcoinbase
Have z_shieldcoinbase use WalletTxBuilder
2023-04-17 15:08:55 -06:00
Greg Pfeil 1ba0843845
Fix an incorrect error message in a test 2023-04-17 13:51:43 -06:00
Luke Dashjr dd4fdf77d0 RPC/Mining: Restore API compatibility for prioritisetransaction
Breaking API serves no purpose other than to be incompatible with older versions and other implementations that do support priority

(cherry picked from commit bitcoin/bitcoin@870824e919)

Zcash:
* Update the release notes.
* Update the `prioritisetransaction.py` RPC test.
* We don't have BIP 68 or replace-by-fee.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Daira Emma Hopwood 54fe279ef8 Fix mempool_packages and prioritisetransaction RPC tests.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Daira Emma Hopwood ea9fa3f06e Fix tests that failed due to the minimum relay fee being enforced.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Daira Emma Hopwood d20a52faaa Fix some messages, comments, and documentation that:
* used "fee" to mean "fee rate", "kB" to mean 1000 bytes, "satoshis"
  to mean zatoshis, or that incorrectly used "BTC" in place of "ZEC";
* used obsolete concepts such as "zero fee" or "free transaction"; or
* did not accurately document their applicability.

Uses of "satoshis" as a JSON key are not altered.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Alex Morcos c42be7ca10 [rpc] Remove priorityDelta from prioritisetransaction
This a breaking API change to the prioritisetransaction RPC call which previously required exactly three arguments and now requires exactly two (hash and feeDelta).  The function prioritiseTransaction is also updated.

(cherry picked from commit bitcoin/bitcoin@f9b9371c60)

Zcash: We don't have `LoadMempool` or `DumpMempool`.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Alex Morcos 1cf62dbcc6 [rpc] Remove priority information from mempool RPC calls
"startingpriority" and "currentpriority" are no longer returned in the JSON information about a mempool entry.  This affects getmempoolancestors, getmempooldescendants, getmempooolentry, and getrawmempool.

(cherry picked from commit bitcoin/bitcoin@49be7e1bef)

Zcash:
* Adjusted because we don't have bitcoin/bitcoin@5ec0cde371
* Update Zcash-specific tests.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Alex Morcos 3972c7e6b6 [test] Remove priority from tests
Remove all coin age priority functionality from unit tests and RPC tests.

(cherry picked from commit bitcoin/bitcoin@0315888d0d)

Zcash:
* We cannot remove the `pool` parameter from the `CTxMemPool` constructor
  because we do not have bitcoin/bitcoin#9138. (Backporting that PR is
  unnecessary and would be a distraction from the purpose of this one;
  the changes made by it are orthgonal.)
* We don't have `prioritise_transaction.py`, `MempoolAncestorIndexingTest`,
  `MempoolSizeLimitTest`, or the `estimateSmartFee` functionality, so omit
  the changes for those.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Alex Morcos a4346b2012 [rpc] sendrawtransaction no longer bypasses minRelayTxFee
The prioritisetransaction API can always be used if a transaction needs to be submitted that bypasses minRelayTxFee.

(cherry picked from commit bitcoin/bitcoin@ad727f4eaf)

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Alex Morcos dbf52938af [mining] Remove -blockprioritysize.
Remove ability of mining code to fill part of a block with transactions sorted by coin age.

(cherry picked from commit bitcoin/bitcoin@272b25a6a9)

Zcash:
* Add release notes.
* Remove a static assertion that no longer applies.
* Spell "prioritise" and "prioritisation" (when referring to tx prioritisation) consistently
  with 'ise', to match the "prioritisetransaction" RPC call.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
MarcoFalke 9a7dc79c08 wallet: Remove sendfree
This removes the option from the wallet to not pay a fee on "small"
transactions which spend "old" inputs.

This code is no longer worth keeping around, as almost all miners
prefer not to include transactions which pay no fee at all.

(cherry picked from commit bitcoin/bitcoin@ddf58c7573)

Zcash:
* Add release notes.
* Use `UIError` instead of `InitWarning` for the warning that
  `-sendfreetransactions` is no longer supported (because we haven't
  refactored `InitWarning` to be accessible from the wallet code).
* Update the `show_help` RPC test to remove `-sendfreetransactions`.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:45 +01:00
Suhas Daftuar e01ad01c94 Fix mempool limiting for PrioritiseTransaction
Redo the feerate index to be based on mining score, rather than fee.

Update mempool_packages.py to test prioritisetransaction's effect on
package scores.

(cherry picked from commit bitcoin/bitcoin@eb306664e7)

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-17 18:49:41 +01:00
Greg Pfeil 55ebf19c55
Address review feedback on z_shieldcoinbase 2023-04-17 11:47:11 -06:00
Greg Pfeil 993dc0c279
Have z_shieldcoinbase use WalletTxBuilder
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-04-17 03:47:11 -06:00
Daira Emma Hopwood 7c7e8645bc Change ZIP 401 mempool limiting to use constants decided in zcash/zips#565.
fixes #6518

In a ZIP sync meeting we decided that:

* The minimum cost should be changed to 10000, in order to avoid
  penalizing Orchard-using transactions too much relative to other
  transactions.
* `low_fee_penalty` should be changed to 40000. This preserves the
  property that a transaction paying less than the ZIP 317 conventional
  fee is deprioritized relative to a min-cost, conventional-fee
  transaction by a factor of 5, as in the original design.
* The recommended default for `mempooltxcostlimit` should remain at
  80000000. Rationale: 80000000 was chosen so that the worst-case size
  of the mempool would be equal to the worst-case size of 40 blocks,
  which is the current default transaction expiry delta. That reasoning
  still holds even with the above changes.
* `eviction_memory_entries` remains at 40000. It could have been lowered
  given that there will now be at most 80000000/10000 = 8000 transactions
  "in-flight", but it doesn't need to be because the rationale that
  "40000 [RecentlyEvicted queue] entries can be stored in ~1.6 MB,
  which is small compared to other node memory usage" still holds.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-16 23:04:57 +01:00
Greg Pfeil 2e80bd74cf
Use null as the ZIP 317 fee sentinel instead of -1
Fixes #6556
2023-04-15 16:12:42 -06:00
Kris Nuttycombe 6ad60e7340
Merge pull request #6524 from sellout/zip317-wallet-support
Support ZIP 317 fees in the zcashd wallet
2023-04-14 14:14:11 -06:00
Daira Hopwood 6ae7c532ce
Change spelling of prioritisation in an error message
For consistency with the `prioritisetransaction` RPC method.
2023-04-14 19:49:58 +01:00
Greg Pfeil 0b9b5c8dc1
Address review feedback for ZIP 317 fees in wallet 2023-04-13 19:20:10 -06:00
Greg Pfeil c54c4ee987
Adjust wallet absurd fee check for ZIP 317
It now happens async (in `PrepareTransaction`) and ensures that the fee doesn’t
exceed the maximum useful value for a transaction.
2023-04-13 19:16:09 -06:00
Greg Pfeil 2596b4920b
Fix edge case revealed by #6409
Without `AllowRevealedRecipients`, we can’t send transparent change, but previously we asserted if
we couldn’t get a transparent change address. Now it returns a new `TransparentChangeNotAllowed`
failure, which is just a more specific `TransparentRecipientNotAllowed` to avoid confusion when
there are no explicit unshielded recipients.
2023-04-13 12:47:52 -06:00
Greg Pfeil 2e0eb32892
Remove unnecessary explicit privacy policy
This was added in c1dbe12d77 as an inadvertent
workaround for the bug fixed by the commit before this one.
2023-04-12 11:43:26 -06:00
Greg Pfeil f7a27e8089
Revert "Add `AllowRevealedSenders` to fix `mempool_nu_activation.py`"
This reverts commit 6f5360fbd8.
2023-04-12 09:22:19 -06:00
Greg Pfeil c6001268c5
Address review feedback re: ZIP 317 in wallet 2023-04-11 13:21:48 -06:00
Greg Pfeil dac6c014d4
Correct change handling for ZIP 317 fees 2023-04-10 00:23:22 -06:00
Greg Pfeil fc6eca86e2
Support ZIP 317 fees in the zcashd wallet
- still support explicit fixed fees everywhere – if a caller provides a fee, we
  don’t adjust it
- treat negative fees as signifier for use of ZIP 317 fees when a fee needs to
  be provided because of additional positional arguments
2023-04-10 00:20:29 -06:00
Greg Pfeil 7f0592a664
Simplify canResolveOrchard logic
When deciding whether we can pay Orchard receivers, rather than checking
whether we have “sufficient non-Sprout funds”, we can just check whether the
selector selects Sprout – if it doesn’t then we can select Orchard receivers
regardless, and we’ll catch insufficient funds later.

This is also helpful for ZIP 317, because in that case we don’t even know the
total non-Sprout funds necessary until after we decide which receivers to pay.
2023-04-10 00:19:39 -06:00
Kris Nuttycombe 881ab6b46a
Merge pull request #6540 from daira/rpconnect-doc
Correct the documentation of `-rpcconnect` in the example `zcash.conf`
2023-04-09 22:38:15 -06:00
Kris Nuttycombe 6f5360fbd8 Add `AllowRevealedSenders` to fix `mempool_nu_activation.py` 2023-04-09 20:58:01 -06:00
Daira Emma Hopwood 2620e6e08c Correct the documentation of `-rpcconnect` in the example `zcash.conf`.
`-rpcconnect` is only used by `zcash-cli`.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-09 15:21:33 +01:00
Greg Pfeil 1786c60677
Require `AllowRevealedRecipients` for t-change 2023-04-01 22:58:52 -06:00
Greg Pfeil af2526d755
Improve taddr no-memo check
Do the check deeper, preventing test_bitcoin from being able to bypass it. This
also moves it out of z_sendmany-specific code, which will be helpful when we add
other operations, like sendfromaccount.
2023-03-28 16:28:16 -06:00
Kris Nuttycombe 58e8d8620c revert broken "safe extract" functionality in golden tests. 2023-03-28 12:27:59 -06:00