Commit Graph

1264 Commits

Author SHA1 Message Date
arielgabizon 06affbca05 rename HaveJoinSplitRequirements for Sapling 2018-10-29 20:56:13 +01:00
Simon c94f4477e8 For #3546. Shielded tx with missing inputs are not treated as orphans. 2018-10-05 10:48:03 -07:00
Homu 75c1dbc5eb Auto merge of #3452 - LarryRuane:3399-peer-ban-test, r=bitcartel
Test peer banning logic in both pre- and post-initial block download states

The DoS ban scores are different for each, and it's nice to test both.

Follow-on from #3410.
2018-09-19 10:25:23 -07:00
Larry Ruane 6206d86237 Test peer banning logic in both pre- and post-initial block download states 2018-09-12 13:30:01 -06:00
Jack Grigg c861137624
net: Check against the current epoch's version when disconnecting peers 2018-09-12 10:17:33 +01:00
Jack Grigg ebf4c0671e
net: Check against the current epoch's version when rejecting nodes 2018-09-12 09:27:28 +01:00
Jack Grigg 13751895c7
Move RewindBlockIndex log message inside rewindLength check 2018-08-08 12:08:29 +01:00
Daira Hopwood 66856b2b3c Support testnet rollback.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-08-02 23:10:30 +01:00
Eirik Ogilvie-Wigley 4fc309f0f5 Rename Merkle Trees to include sprout or sapling 2018-08-01 10:31:09 -06:00
Sean Bowe 291895fac7 Ensure sum of valueBalance and all vpub_new's does not exceed MAX_MONEY inside of CheckTransactionWithoutProofVerification. 2018-07-30 22:35:31 -06:00
Larry Ruane 772f87aaeb don't ban peers when loading pre-overwinter blocks 2018-07-26 12:29:04 -06:00
Eirik Ogilvie-Wigley f86ee1c252 Pass sapling merkle tree when incrementing witnesses 2018-07-25 20:47:41 -07:00
Homu 3835cbb57f Auto merge of #3263 - str4d:ibd-upstream-changes, r=bitcartel
InitialBlockDownload upstream changes

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7208
- bitcoin/bitcoin#8007
- bitcoin/bitcoin#9053
  - Excluding second commit (requires bitcoin/bitcoin#8865)
- bitcoin/bitcoin#10388
2018-07-17 13:17:27 -07:00
Homu 9acfa0067f Auto merge of #3258 - Eirik0:3056-anchor-test-cases, r=str4d
Add tests for sapling anchors

Closes #3253
2018-06-19 09:28:20 -07:00
Homu f62fff80d5 Auto merge of #3255 - str4d:sapling-value-pool, r=ebfull
Track net value entering and exiting the Sapling circuit
2018-05-16 10:46:32 -07:00
Eirik Ogilvie-Wigley 3182b4abc3 Add tests for sapling anchors 2018-05-16 10:31:53 -06:00
Alex Morcos bbff8631f5
Output line to debug.log when IsInitialBlockDownload latches to false 2018-05-15 22:18:11 +12:00
Gregory Maxwell f04a90afb2
IsInitialBlockDownload no longer uses header-only timestamps.
This avoids a corner case (mostly visible on testnet) where bogus
 headers can keep nodes in IsInitialBlockDownload.
2018-05-15 22:18:04 +12:00
Gregory Maxwell e41632c9fb
IBD check uses minimumchain work instead of checkpoints.
This introduces a 'minimum chain work' chainparam which is intended
 to be the known amount of work in the chain for the network at the
 time of software release.  If you don't have this much work, you're
 not yet caught up.

This is used instead of the count of blocks test from checkpoints.

This criteria is trivial to keep updated as there is no element of
subjectivity, trust, or position dependence to it. It is also a more
reliable metric of sync status than a block count.
2018-05-15 21:25:19 +12:00
Kaz Wesley 02eedeeb69
IsInitialBlockDownload: usually avoid locking
Optimistically test the latch bool before taking the lock.
For all IsInitialBlockDownload calls after the first to return false,
this avoids the need to lock cs_main.
2018-05-15 21:25:19 +12:00
Wladimir J. van der Laan 29aaf13b0a
Make max tip age an option instead of chainparam
After discussion in #7164 I think this is better.

Max tip age was introduced in #5987 to make it possible to run
testnet-in-a-box. But associating this behavior with the testnet chain
is wrong conceptually, as it is not needed in normal usage.
Should aim to make testnet test the software as-is.

Replace it with a (debug) option `-maxtipage`, which can be
specified only in the specific case.
2018-05-15 21:24:58 +12:00
Homu ae6c2587d3 Auto merge of #3232 - ebfull:3207-sapling-validation, r=str4d
Sapling validation

**Also review https://github.com/zcash/librustzcash/pull/7**

This is an attempt to tackle much of https://github.com/zcash/zcash/issues/3065
2018-05-10 10:21:15 -07:00
Jack Grigg ae97177c86
Track net value entering and exiting the Sapling circuit 2018-05-09 16:02:23 -04:00
Jack Grigg 97b46f00cc
Add valueBalance to value balances, and enforce its consensus rules 2018-05-09 11:34:41 +01:00
Sean Bowe b4db32f53c Check Sapling Spend/Output proofs and signatures. 2018-05-08 14:30:26 -06:00
Sean Bowe 55fabd8272 Refactor so that dataToBeSigned can be used later in the function for other purposes. 2018-05-08 14:28:01 -06:00
Sean Bowe 6eea48bf96 Remove unnecessary IsCoinbase() check. Coinbases are guaranteed to have empty vjoinsplit. 2018-05-08 14:23:09 -06:00
Homu 333b9a0d0b Auto merge of #3170 - ebfull:sapling-merkle-tree, r=ebfull
Sapling merkle tree implementation

Closes #3056.

Please also review https://github.com/zcash/librustzcash/pull/8

This PR:

1. Introduces ZCSaplingIncrementalMerkleTree using Pedersen hashes.
2. Adds support for Sapling anchors into consensus rules. (Adds commitments, checks anchors are correct, handles block (dis)connects, etc.)
3. Handles mempool eviction for obsolete anchors.
4. Enforces correctness of block's Sapling root field
5. Changes miner to correctly apply the Sapling root to the block header
6. Handles mempool consistency checks for anchors
2018-05-07 20:37:46 -07:00
Sean Bowe 98d2f090ca Evict transactions with obsolete anchors from the mempool 2018-05-07 14:37:46 -06:00
Sean Bowe 1f8be05b63 Add consensus support for Sapling merkle trees. 2018-05-07 14:37:46 -06:00
Sean Bowe c643ff0b51 Add support for PopAnchor(.., SPROUT/SAPLING) 2018-05-07 14:37:46 -06:00
Sean Bowe e814be60fe Rename hashSproutAnchorEnd to hashFinalSproutRoot to be consistent. 2018-05-07 14:37:46 -06:00
Sean Bowe 18322f074c Introduce support for GetBestAnchor(SAPLING). 2018-05-07 13:46:06 -06:00
Sean Bowe 2bd59e1473 Rename PushAnchor to PushSproutAnchor. 2018-05-07 13:46:06 -06:00
Sean Bowe 008f4ee8e7 Rename GetAnchorAt to GetSproutAnchorAt. 2018-05-07 13:46:06 -06:00
Sean Bowe 08f0728884 Rename hashAnchor to hashSproutAnchor. 2018-05-07 13:46:06 -06:00
Sean Bowe 28d20bdb11 Rename NullifierType to ShieldedType. 2018-05-07 13:46:06 -06:00
Homu 1d4235dce7 Auto merge of #3239 - str4d:sapling-default-tx-version, r=str4d
Update CreateNewContextualCMutableTransaction for Sapling

Part of #3063.
2018-05-07 12:27:47 -07:00
Homu 265eca3f47 Auto merge of #3212 - str4d:2864-sapling-tx-size-limit, r=str4d
Raise 100kB transaction size limit from Sapling activation

Closes #2864.
2018-05-07 02:20:42 -07:00
Homu 8ef1d333b5 Auto merge of #2894 - per-gron:dont-export-unless-needed, r=str4d
Make some globals static that can be

I wrote this patch as part of making a Bazel build system but it really is independent from that so I'm putting this as a separate PR.

External linkage does not help and just encourages sloppy dependencies (ie using symbols only declared in a cpp file in some other cpp file) and can lead to weird issues when there are name collisions.
2018-05-04 15:05:43 -07:00
Jack Grigg 25fee3509a
Rename MAX_TX_SIZE to MAX_TX_SIZE_AFTER_SAPLING 2018-05-04 11:17:30 +01:00
Jack Grigg 15ec5525e3
Raise 100kB transaction size limit from Sapling activation
Closes #2864.
2018-05-04 11:17:30 +01:00
Jack Grigg fa70084c87
Expire Overwinter transactions before the Sapling activation height 2018-05-03 12:27:56 +01:00
Jack Grigg dc889d7f52
Update CreateNewContextualCMutableTransaction to create Sapling transactions 2018-05-03 12:02:51 +01:00
Homu 0a8d0c25e8 Auto merge of #3220 - Eirik0:3209-fix-CheckTransaction, r=str4d
Implement consensus rules about the number of Spend and Output Descriptions in a transaction

Closes #3209.
Part of #3065.
2018-05-01 07:09:52 -07:00
Marshall Gaucher b300118002
Merge pull request #2813 from str4d/2074-uacomment
Implement uacomment config parameter
2018-04-30 09:12:38 -06:00
Eirik Ogilvie-Wigley 812098256f Coinbase transactions can not have shielded spend or output 2018-04-26 15:53:26 -06:00
Eirik Ogilvie-Wigley 4b4662b06d Make sure transactions have non-empty outputs 2018-04-26 15:24:59 -06:00
Sean Bowe 6679855147
Check that duplicate Sapling nullifiers don't exist within a transaction. 2018-04-25 17:10:34 -06:00
Eirik Ogilvie-Wigley 9669920f75 Rename nullifier caches and maps to indicate sprout nullifiers 2018-04-25 11:26:38 -06:00