Commit Graph

1399 Commits

Author SHA1 Message Date
Jack Grigg 3ff68c5052
Move mempool SyncWithWallets call into its own thread 2019-09-20 21:00:42 +01:00
Jack Grigg 150e330310
Abort node if NU activations have unexpected hashes 2019-09-19 15:00:04 +01:00
Jack Grigg 10b9d6306b
Move AbortNode to the top of main.cpp
It is in an anonymous namespace, so it needs to be above all code in the
file that uses it.
2019-09-19 14:52:55 +01:00
Homu 424d8b1af5 Auto merge of #4115 - LarryRuane:4114-spent-index-debug, r=Eirik0
#4114 Don't call GetSpentIndex() when converting txs to JSON if spent index is disabled

Closes #4114.
2019-08-28 21:09:19 -07:00
Larry Ruane e83168b8c8 better fix: make GetSpentIndex() consistent with others...
but don't call it if insight explorer isn't enabled
2019-08-27 08:37:42 -06:00
Daira Hopwood 7d5de93518 Add intended rewind for Blossom on testnet.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-08-26 21:37:44 +01:00
Larry Ruane 210c46c21d #4114 don't call error() from GetSpentIndex() 2019-08-24 19:05:10 -06:00
Homu 5fd1f5afc0 Auto merge of #3972 - LarryRuane:3708-getblockhashesrpc, r=str4d
3708 getblockhashesrpc

Part of #3708
2019-08-09 08:00:17 -07:00
Homu 2528af69ff Auto merge of #4025 - bitcartel:shorter_block_target_interval_zip208, r=daira
Implement ZIP 208: Shorter Block Target Spacing

Closes #3690.
2019-08-09 02:35:30 -07:00
Larry Ruane 70bda8416a insightexplorer fix LogPrintf 2019-08-08 14:54:47 -06:00
Larry Ruane 6e7e50be4d insightexplorer minor bug fixes 2019-08-08 14:45:30 -06:00
Larry Ruane 2e505df351 add timestampindex related RPC getblockhashes 2019-08-08 14:35:07 -06:00
Larry Ruane 86b23f37ad add spentindex RPC for bitcore block explorer 2019-08-07 14:23:42 -06:00
Eirik Ogilvie-Wigley b99003c1ec Rename method and use int64_t 2019-08-07 10:05:01 -06:00
Eirik Ogilvie-Wigley 8f0a54c142 Remove DefaultExpiryDelta method 2019-08-05 13:40:06 -06:00
Eirik Ogilvie-Wigley 0f0512128c Make sure that expiry height is not less than height 2019-08-05 12:57:10 -06:00
Eirik Ogilvie-Wigley 7ddcf427c0 Fix/update comments 2019-08-05 12:41:31 -06:00
Eirik Ogilvie-Wigley 9f70b74692 Do not add expiring soon threshold to expiry height of txs near NU activation 2019-08-05 11:50:05 -06:00
Eirik Ogilvie-Wigley 8068491d2c Fix check transaction tests 2019-08-04 14:35:47 -06:00
Eirik Ogilvie-Wigley f9d6b3e7ef Extract Halvings method and add tests 2019-08-02 21:37:48 -06:00
Eirik Ogilvie-Wigley 27ee4d64f2 Fix integer truncation in Blossom halving calculation 2019-08-02 19:35:53 -06:00
Eirik Ogilvie-Wigley 65df6225a6 Do not create transactions that will expire after the next epoch 2019-08-02 16:01:20 -06:00
Larry Ruane 68e174e22b add addressindex related RPCs 2019-07-31 10:31:16 -06:00
Eirik Ogilvie-Wigley 8865f4b6f6 Update expiry height for shorter block times 2019-07-30 01:16:37 -06:00
Eirik Ogilvie-Wigley c0d27cb3f2 Simplify PartitionCheck 2019-07-29 18:29:39 -06:00
Eirik Ogilvie-Wigley 2c6c55261d Make NetworkUpgradeAvailable a method of Params 2019-07-29 14:47:06 -06:00
Eirik Ogilvie-Wigley 102dafdf89 Update block subsidy halving for zip208 2019-07-29 13:44:53 -06:00
Daira Hopwood bc909a7a7f Replace http with https: in links to the MIT license.
Also change MIT/X11 to just MIT, since no distinction was intended.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-18 15:26:01 +01:00
Simon d7ebbeb2aa Modify PartitionCheck to be aware of pre & post Blossom target spacing. 2019-07-11 14:17:58 -06:00
Simon 22e8dc2679 Replace nPoWTargetSpacing -> PoWTargetSpacing() in ProcessMessage() 2019-07-11 13:46:29 -06:00
Simon 4b985ce999 Update GetBlockTimeout() to take height parameter. 2019-07-11 13:46:29 -06:00
Homu 984b41422a Auto merge of #4054 - rex4539:haveshieldedrequirements, r=Eirik0
Rename joinsplit to shielded

Closes https://github.com/zcash/zcash/issues/3550
2019-07-11 09:45:19 -07:00
Dimitris Apostolou 8bcb96999e
Rename joinsplit to shielded 2019-06-16 22:50:58 +03:00
Dimitris Apostolou f57f76d789
Rename vjoinsplit to vJoinSplit 2019-06-16 19:13:49 +03:00
Homu bb58c8ec2e Auto merge of #3863 - LarryRuane:3708-getrawtransaction, r=daira
add spentindex to getrawtransaction RPC results for bitcore block explorer

#3708 There are a few new `getrawtransaction` JSON result fields that the Insight block explorer depends on.
2019-06-11 13:15:00 -07:00
Larry Ruane f381d4e085 add spentindex to getrawtransaction RPC results 2019-06-11 10:29:51 -06:00
Daira Hopwood 346d11d3eb Closes #3992. Remove obsolete warning message.
Co-authored-by: Simon <simon@bitcartel.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-06-11 17:27:49 +01:00
Jack Grigg e12d018464
Globals: Explicitly pass const CChainParams& to ReceivedBlockTransactions() 2019-05-23 20:03:35 +01:00
Jack Grigg 3ffc29b881
Globals: Explicitly pass const CChainParams& to IsInitialBlockDownload() 2019-05-23 20:03:34 +01:00
Jack Grigg 9e0f75dcbd
Consistently use chainparams and consensusParams 2019-05-23 17:48:31 +01:00
Jack Grigg a3b64d8677
Globals: Explicitly pass const CChainParams& to DisconnectBlock() 2019-05-23 17:48:30 +01:00
Jack Grigg c6012fe923
Globals: Explicit const CChainParams& arg for main:
- ContextualCheckBlockHeader
- ContextualCheckBlock
2019-05-23 17:48:29 +01:00
Jack Grigg be94721953
Globals: Explicitly pass const CChainParams& to ContextualCheckTransaction() 2019-05-23 17:48:28 +01:00
Jack Grigg 7ef947c32b
Globals: Explicit const CChainParams& arg for main:
- CheckBlockHeader
- CheckBlock
2019-05-23 17:48:27 +01:00
Jack Grigg 13cfabb36c
Globals: Explicitly pass const CChainParams& to IsStandardTx() 2019-05-23 17:48:26 +01:00
Jack Grigg 9f7f70e0c3
Globals: Remove Zcash-specific Params() calls from main.cpp 2019-05-23 17:48:25 +01:00
Wladimir J. van der Laan 3647f0a7b1
Break circular dependency main ↔ txdb
Break the circular dependency between main and txdb by:

- Moving `CBlockFileInfo` from `main.h` to `chain.h`. I think this makes
  sense, as the other block-file stuff is there too.

- Moving `CDiskTxPos` from `main.h` to `txdb.h`. This type seems
  specific to txdb.

- Pass a functor `insertBlockIndex` to `LoadBlockIndexGuts`. This leaves
  it up to the caller how to insert block indices.

Zcash: This does not actually break the circular dependency for us yet, as we
still need to pull in bitcoin/bitcoin#7756 and bitcoin/bitcoin#7904.
2019-05-23 17:48:24 +01:00
face e9128c4a1d
Explicitly pass CChainParams to ConnectBlock 2019-05-23 17:48:23 +01:00
face f2baeb7cb6
Pass CChainParams to DisconnectTip() 2019-05-23 17:48:22 +01:00
Jorge Timón a68c8114e1
Globals: Explicitly pass const CChainParams& to UpdateTip() 2019-05-23 17:48:21 +01:00
MarcoFalke 98f3010026
[doc] Fix doxygen comments for members 2019-05-23 17:48:20 +01:00
Jorge Timón 44b2d060ef
Globals: Remove a bunch of Params() calls from main.cpp:
1) Chainparams: Explicit CChainParams arg for main:

-AcceptBlock
-AcceptBlockHeader
-ActivateBestChain
-ConnectTip
-InitBlockIndex
-LoadExternalBlockFile
-VerifyDB parametric constructor

2) Also pickup more Params()\. in main.cpp

3) Pass nPruneAfterHeight explicitly to new FindFilesToPrune() in main.cpp
2019-05-23 17:48:18 +01:00
Jorge Timón 8e5d8ca52a
Chainparams: Explicit CChainParams arg for main (pre miner):
-ProcessNewBlock
-TestBlockValidity
2019-05-23 17:48:16 +01:00
Jorge Timón 94debefbcf
Globals: Make AcceptBlockHeader static (Fix #6163)
..and at the same time prevent AcceptBlockHeader() from calling global function Params()
2019-05-23 17:48:15 +01:00
Jorge Timón 71cf6ba98b
Globals: Explicit Consensus::Params arg for main:
-CheckBlockIndex
-DisconnectTip
-GetTransaction
-InvalidateBlock
-ProcessGetData
-ReadBlockFromDisk
2019-05-23 17:48:14 +01:00
Jack Grigg cea06a4fd3
Move Equihash parameters into consensus params 2019-05-23 17:48:13 +01:00
Daniel Kraft 9a529fd217
Add some const declarations where they are appropriate.
Declare some arguments of functions as "const" pointers where they are
not meant to be modified.
2019-05-23 17:48:04 +01:00
Daira Hopwood 5eb7129d95 Generalize TransactionBuilder and CreateNewContextualCMutableTransaction to allow choosing the expiry delta.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-05-10 13:48:43 +01:00
Homu 63fff636d7 Auto merge of #3968 - bitcartel:3768_enable_mainnet_turnstile, r=bitcartel
Activate turnstile on mainnet

This PR enables [ZIP209](https://github.com/zcash/zips/blob/master/zip-0209.rst) support on mainnet, to mark blocks as invalid if they would lead to a turnstile violation in the Sprout or Sapling value pools.

To test this PR, I performed the following manual tests:

1. Used RPC call `getblock` to verify the fallback Sprout value.
2. Individually changed the fallback Sprout block hash, block height and chain value, recompiling and relaunching the node, verifying that each individual change resulted in an error.  When the block hash and block height are incorrect, an error is logged to debug.log `FallbackSproutValuePoolBalance(): fallback block hash is incorrect`.  An incorrect chain value results in node termination with error: `void FallbackSproutValuePoolBalance(CBlockIndex*, const CChainParams&): Assertion '*pindex->nChainSproutValue == chainparams.SproutValuePoolCheckpointBalance()' failed.`
3. Ran the `Smoke Testing` described in PR #3885, on mainnet.
4. Launched zcashd with experimental feature `-developersetpoolsizezero` to manually trigger a turnstile violation in both Sprout and Sapling shielded pools.  The Sprout turnstile violation occurred after launch, due to chance, when the next incoming block 520786 contained a Sprout unshielding transaction. The Sapling turnstile violation was triggered after creating a Sapling unshielding transaction.
2019-04-29 09:08:46 -07:00
Larry Ruane 7fb8088288 add -timestampindex for bitcore insight block explorer 2019-04-26 08:44:56 -06:00
Homu 1b24243392 Auto merge of #3849 - LarryRuane:3708-spentindex, r=daira
add SpentIndex changes needed for bitcore block explorer

Addresses #3708, follow-on to #3837, note there are no tests yet (will come later with RPC interfaces).
2019-04-25 16:32:22 -07:00
Simon 867786d777 Enable experimental feature -developersetpoolsizezero on mainnet. 2019-04-24 08:40:17 -07:00
Larry Ruane 3d018ab556 add -spentindex changes for bitcore insight block explorer 2019-04-23 11:06:23 -06:00
Simon 4c1a8884f4 Add testnet and regtest experimental feature: -developersetpoolsizezero 2019-04-22 14:24:40 -07:00
Larry Ruane 6cf0e50b56 add -addressindex changes for bitcore insight block explorer 2019-03-28 12:03:48 -06:00
Sean Bowe 8d0e2befe7 (minor) Remove added newline. 2019-03-19 12:45:21 -06:00
Sean Bowe 30a5d6f520 Only enforce Sapling turnstile if balance values have been populated. 2019-03-18 14:09:32 -06:00
Sean Bowe b5c7e63bcd Change SproutValuePoolCheckpointEnabled to ZIP209Activated 2019-03-18 11:32:26 -06:00
Sean Bowe 6482b661ab Check blockhash of fallback block for Sprout value pool balance 2019-03-14 15:39:11 -06:00
Sean Bowe 831725a671 Use existing chainparams variable 2019-03-14 15:25:10 -06:00
Sean Bowe 2b1252af80 Consolidate logic to enable turnstile auditing for testnet/regtest/mainnet. 2019-03-14 14:29:04 -06:00
Sean Bowe cb6df4b0cc Fix tallying for Sprout/Sapling value pools. 2019-03-14 14:08:12 -06:00
Sean Bowe 8a990a7d64 (testnet) Reject blocks that result in turnstile violations 2019-03-13 00:54:29 -06:00
Sean Bowe 24db3297df (testnet) Fall back to hardcoded shielded pool balance to avoid reorgs. 2019-03-13 00:43:54 -06:00
Pieter Wuille ec555a8e9b Simplify DisconnectBlock arguments/return value
DisconnectBlock currently has a complicated interface:

  Situation       Return value
                  pfClean != nullptr   pfClean == nullptr

  All good:       true                 true
  Failure:        false                false
  Unclean rewind: true                 false
                  with *pfClean=false

Change this to return a tristate enum instead. As an added bonus,
remove the ValidationState& argument which was unused.
2019-02-26 11:10:20 -07:00
Homu 9cd74866c7 Auto merge of #3262 - str4d:2074-perf-1, r=str4d
Bitcoin 0.12 performance improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6918
- bitcoin/bitcoin#6932

Part of #2074.
2018-11-30 15:25:33 -08:00
Simon cc1ab2db55 For ZEC-013. Don't propagate txs which are expiring soon in p2p messages.
When responding to "mempool" message, do not include the txid of an
expiring soon transaction in the "inv" message reply.
When responding to "getdata" message, do not reply with a "tx" message
for a transaction which is expiring soon.
2018-11-17 09:02:00 -08:00
Simon f8cd79c2de For ZEC-013. Mitigate potential tx expiry height related DoS vector.
Don't accept transactions which are about to expire (next 3 blocks).
Don't set a ban score if a peer does propragate these transactions.
See ZEC-013 for more detail.
2018-11-17 09:01:49 -08:00
Homu ed6b10018a Auto merge of #3670 - LarryRuane:3399-peer-ban-overwinter, r=bitcartel
don't ban peers when loading pre-sapling (and pre-blossom) blocks

Resolves #3399.
2018-11-16 19:22:48 -08:00
Homu 570e09ea59 Auto merge of #2815 - str4d:2074-relay-pruning, r=bitcartel
Relay blocks when pruning

Cherry-picked from https://github.com/bitcoin/bitcoin/pull/6148

Part of #2074.
2018-11-15 10:28:44 -08:00
Larry Ruane 4f53418c88 don't ban peers when loading pre-sapling (and pre-blossom) blocks 2018-11-13 17:37:59 -07:00
arielgabizon 06affbca05 rename HaveJoinSplitRequirements for Sapling 2018-10-29 20:56:13 +01:00
Alex Morcos 7335afabd4
ModifyNewCoins saves database lookups
When processing a new transaction, in addition to spending the Coins of its txin's it creates a new Coins for its outputs.  The existing ModifyCoins function will first make sure this Coins does not already exist.  It can not exist due to BIP 30, but because of that the lookup can't be cached and always has to go to the database.  Since we are creating the coins to match the new tx anyway, there is no point in checking if they exist first anyway.

Zcash: Modified to account for the fact that BIP 30 and BIP 34 have applied
from the beginning.
2018-10-24 19:28:39 +08:00
Pieter Wuille cf47f9550e
Don't wipe the sigcache in TestBlockValidity 2018-10-24 19:28:39 +08: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