Commit Graph

501 Commits

Author SHA1 Message Date
Simon ba411d17a2 Fix serialization in Insight explorer code.
Remove nType and nVersion from serialization
Fix CScript serialization
2018-09-08 15:46:53 -07:00
Chethan Krishna 1537c902dc logical timestamp indexing of block hashes 2018-09-05 13:08:08 -07:00
Braydon Fuller 7aabf02719 db: add options to configure block index database
There was a previous assumption that blockindex would be quite small. With addressindex
and spentindex enabled the blockindex is much larger and the amount of cache allocated for
it should also increase. Furthermore, enabling compression should decrease the amount of
disk space required and less data to write/read. The default leveldb max_open_files is set to
1000, for the blockindex the default is set to 1000 with compression. The 64 value that is
current is kept for the utxo database and does not enable compression. Two additional options
are added here to be able to configure the values for leveldb and the block index:

- `-dbmaxopenfiles` A number of files for leveldb to keep open
- `-dbcompression` Boolean 0 or 1 to enable snappy leveldb compression
2018-09-05 13:05:50 -07:00
Braydon Fuller 6e50c56edd main: spentindex for the mempool
Zcash: Adapted to older mempool code
2018-09-05 13:05:49 -07:00
Braydon Fuller 67c95dcb7f main: add amount and address to spentindex value 2018-09-05 13:05:49 -07:00
Braydon Fuller ca0ee59d6e rpc: fix issue with querying txids by block heights 2018-09-05 12:58:14 -07:00
Braydon Fuller bf64e834c6 main: add spentindex option 2018-09-05 12:58:12 -07:00
Braydon Fuller e85d165115 main: sort address index utxos by height 2018-09-05 12:55:33 -07:00
Braydon Fuller 110adc6aa7 main: remove spent address utxo indexes 2018-09-05 12:55:33 -07:00
Braydon Fuller 724f06da7c main: index unspent outputs by address 2018-09-05 12:55:30 -07:00
Braydon Fuller 98872dac95 main: get address deltas between range of block heights 2018-09-05 12:52:56 -07:00
Braydon Fuller 70600ae1ff main: fixed bug with overlapping address index keys
There was a bug where the spending address index could have the same key
as the receiving address index if the input and output indexes matched. This lead
to the output always overwriting the input index leading to incorrect balances
with missing spent amounts. This patch separates the two so that they have unique
keys so balances will be correctly calculated.
2018-09-05 12:51:27 -07:00
Braydon Fuller 4fcfdc9b21 main: add block timestamp index 2018-09-05 12:51:25 -07:00
Braydon Fuller 8432e73cf2 main: serialize height in BE for address index key
fixes a sorting issue when iterating over keys
2018-09-05 12:47:11 -07:00
Braydon Fuller a9948959b5 main: index address index sorted by height 2018-09-05 12:45:35 -07:00
Braydon Fuller 205830690b main: start of address index
Adds a configuration option for addressindex to search for txids by address. Includes
an additional rpc method for getting the txids for an address.
2018-09-05 12:44:31 -07:00
Daira Hopwood 66856b2b3c Support testnet rollback.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-08-02 23:10:30 +01: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
Pieter Wuille 242f1421db
Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.

Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2018-04-17 13:09:28 +01:00
Jay Graber 9bb37bf0d5 Implement transaction expiry for Overwinter 2018-02-23 00:12:03 -08:00
Homu d4d2844829 Auto merge of #2463 - str4d:713-rollback-limit, r=str4d
Implement roll-back limit for reorganisation

Part of  #2905. Closes #713.
2018-02-20 15:17:22 -08:00
Jack Grigg be12669982
Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter
We do not need to be able to calculate multiple SignatureHash versions for a
single transaction format; instead, we use the transaction format to determine
the SigVersion.

The consensus branch ID *does* need to be passed in from the outside, as only
the caller knows the context in which the SignatureHash is being calculated
(ie. mempool acceptance vs. block validation).

JoinSplit signature verification has been moved into ContextualCheckTransaction,
where the consensus branch ID can be obtained.

The argument to the sign command for zcash-tx has been modified to take a height
in addition to the optional sigtype flags.
2018-02-20 04:22:20 +00:00
Pieter Wuille 6514771a44
Rename to PrecomputedTransactionData 2018-02-20 04:22:20 +00:00
Pieter Wuille f762d44973
Precompute sighashes
Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.

Edited for Zcash by Ariel Gabizon and Jack Grigg
2018-02-20 04:22:20 +00:00
Jorge Timón 722d811f89
Mempool: Use Consensus::CheckTxInputs direclty over main::CheckInputs 2018-02-20 04:22:20 +00:00
Pieter Wuille 2d42e1a993
Refactor script validation to observe amounts
This is a preparation for BIP143 support.

Edited for Zcash merge by Ariel Gabizon.
2018-02-20 04:22:19 +00:00
21E14 8cb98d9105
Remove obsolete reference to CValidationState from UpdateCoins. 2018-02-20 04:22:18 +00:00
Homu 49274558c6 Auto merge of #2940 - str4d:nu-activation-mempool-expiry, r=str4d
Mempool improvements, branch ID awareness

Whenever the local chain tip is updated, transactions in the mempool which commit to an
unmineable branch ID (for example, just before a network upgrade activates, where the
next block will have a different branch ID) will be removed.

Includes commits cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6654
  - Only the mempool index change.
- bitcoin/bitcoin#6776
- bitcoin/bitcoin#7020
- bitcoin/bitcoin#6915

Part of #2074.
2018-02-19 19:00:30 -08:00
Matt Corallo fe5cef0555
removeForReorg calls once-per-disconnect-> once-per-reorg 2018-02-20 02:57:44 +00:00
Jack Grigg 57e6ecda5a
Implement roll-back limit for reorganisation
Closes #713.
2018-02-19 16:32:42 +00:00
Simon 072099d788 Implementation of Overwinter transaction format ZIP 202. 2018-02-16 10:10:15 -08:00
Jack Grigg 9e851450ab
Adjust rewind logic to use the network upgrade mechanism 2018-02-04 22:58:42 +00:00
Pieter Wuille 89f20450c2
Add rewind logic to deal with post-fork software updates
Includes logic for dealing with pruning by Suhas Daftuar.
2018-02-04 22:58:42 +00:00
Luke Dashjr a79c8e24a5
Fix various warnings
Found while building on Debian 7
2017-03-03 10:57:15 -08:00
Jorge Timón e079f010bf
Consensus: Refactor: Separate Consensus::CheckTxInputs and GetSpendHeight in CheckInputs
Zcash:
- Replaces some of the refactoring performed in #1017
- Exposed Consensus::CheckTxInputs for testing
2017-03-03 10:57:09 -08:00
Philip Kaufmann db954a65ac
use const references where appropriate 2017-03-03 10:57:05 -08:00
Simon 0f724e716d Closes #1969. Default fee now sufficient for large shielded tx.
Sets default min relay tx fee to 100, which is used to initialize
nSatoshisPerK for min fee calculation.  The default z_sendmany
fee of 10000 is now sufficient to cover a tx of size 100000 bytes,
so txs will not be treated as "free" and hit the free rate limiter.
2017-02-28 11:43:04 -08:00
Jack Grigg 1f015f6afa
Add a flag for enabling experimental features 2017-02-09 22:10:58 +00:00
Jack Grigg 6fb8d0c2d6
Skip JoinSplit verification before the last checkpoint
Part of #1749
2016-12-09 21:06:45 +13:00
Simon e2a6161f4a Closes #1901. Increase default settings for the max block size when
mining and the amount of space available for priority transactions.
2016-11-29 10:01:20 -08:00
Simon ba0625f25d Set default minrelaytxfee to 1000 zatoshis to match upstream.
A txout will be considered dust when it has a value <546 zatoshis.
Helps to address #1719.
2016-11-15 10:48:51 -08:00
Sean Bowe 74f15a73a1 Make 100KB transaction size limit a consensus rule, rather than a standard rule. 2016-10-08 00:00:23 -06:00
zkbot efe18f2e9b Auto merge of #1374 - str4d:1106-alert-safe-mode, r=str4d
Enable high-priority alerts to put the RPC into safe mode

This reverts the changes in 986b5e257e and adds a priority check.

Continuation of #1337
Closes #1106
2016-10-03 17:36:59 -04:00
Simon db0f931570 Add founders reward to ChainParams.
Fix bug where subsidy slow shift was ignored.
2016-09-30 14:42:47 -07:00
Jack Grigg a40034f7d6 Enable high-priority alerts to put the RPC into safe mode
This reverts the changes in 986b5e257e and adds a
priority check.

Closes #1106
2016-09-23 17:26:43 +12:00
Daira Hopwood b93c8139e6 Decrease MAX_HEADERS_RESULTS to 160. fixes #1289
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-08-24 06:14:09 +01:00
Daira Hopwood c6a7e897bc Add mostly-static checks on consistency of Equihash parameters, MAX_HEADERS_RESULTS, and MAX_PROTOCOL_MESSAGE_LENGTH.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-08-24 06:13:06 +01:00
Taylor Hornby 948d4e6c10 Split JoinSplit proof verification out of CheckTransaction. 2016-06-23 16:35:31 -06:00
Sean Bowe d212ba320b Disable enforced coinbase protection in miner_tests. 2016-06-14 15:18:52 -06:00
Sean Bowe c0dde76d8a Disable coinbase-must-be-protected rule on regtest. 2016-06-13 12:23:55 -06:00