Commit Graph

77 Commits

Author SHA1 Message Date
Alex Morcos f41775b2c8
Implement helper class for CTxMemPoolEntry constructor
This is only for unit tests.
2018-02-09 18:35:25 +00:00
Mark Friedenbach fe53749dc9
Explicitly set tx.nVersion for the genesis block and mining tests
If/when CTransaction::CURRENT_VERSION is incremented, this will break CChainParams and the miner tests. This fix sets the transaction version explicitly where we depend on the hash value (genesis block, proof of work checks).
2018-01-22 10:30:41 -05:00
Jack Grigg 2857f6960d
Regenerate miner tests
Closes #2271.
2017-05-16 22:38:07 +12:00
Jack Grigg 657bde55ef
Update tests for new genesis blocks
Miner tests have been commented out, and will be regenerated after launch.
2016-10-28 02:56:15 -07:00
Jack Grigg ab32254909
Update tests for new genesis blocks 2016-10-27 02:45:21 -07:00
Jack Grigg 2f5d62fe32
Remove Founders' Reward override from #1398 2016-10-26 21:05:17 -07:00
Jack Grigg 86d2c90468
Update tests for new genesis blocks 2016-10-22 00:52:58 -05:00
Jack Grigg 8c54e34a68
Use tromp's solver to regenerate miner tests
When using, comment out tromp's solver in miner.cpp to avoid linker errors.
2016-10-22 00:52:56 -05:00
Simon 2d6e97ecc5 Add field fMinerTestModeForFoundersRewardScript to chainparams 2016-09-30 18:31:51 -07:00
zkbot 2271d3feda Auto merge of #1338 - str4d:147-tweak-difficulty-adjustment-algorithm, r=ebfull
Tweaks to difficulty adjustment algorithm

This PR changes the difficulty algorithm to adjust from the average difficulty over the
block window instead of from the last difficulty. It also removes the special rules for the
testnet, which are incompatible with difficulty averaging.

Closes #147 again.
2016-09-08 02:21:13 +00:00
Simon 805344dcf4 Refactor: replace calls to GetTxid() with GetHash() 2016-09-07 15:12:09 -07:00
Jack Grigg 4a749674a8 Update tests for new genesis blocks 2016-09-07 21:05:12 +12:00
Jack Grigg 5be6abbf84 Store the Equihash solution in minimal representation in the block header
The genesis blocks and miner tests have been regenerated, because changing the
block header serialisation format changes the block hash, and thus validity.

The Equihash solutions have been removed from the bloom test inputs for
simplicity (block validity is not checked there; only a valid serialisation is
necessary).
2016-08-16 16:02:39 +12:00
Jack Grigg caa0348f04 Update Equihash hash generation to match the Zcash spec
Changes:

- floor(512/n)*n/8 bytes of BLAKE2b output is split between floor(512/n)
  adjacent indices, instead of using one hash call per index.

- Parameters with n/(k+1) mod 8 != 0 will expand the BLAKE2b output to byte
  boundaries for colliding, instead of using a longer output and clearing bits.

- The genesis blocks have been regenerated.

- The test vectors have been regenerated.

- The Equihash inputs for the cancellation tests were modified to ensure that
  valid solutions were available to exercise the full solver.
2016-08-16 11:02:04 +12:00
Jack Grigg a23507d086 Update tests to account for new Equihash parameters 2016-08-06 17:33:23 +12:00
Simon 0ccb650b5a Update genesis block hashes and test data. 2016-07-27 00:55:48 -07:00
Simon 2481bab2b8 Revert "Set nLockTime in CreateNewBlock() so coinbase txs do not have the same txid."
This reverts commit 29306269f4.
2016-07-27 00:41:26 -07:00
Simon 29306269f4 Set nLockTime in CreateNewBlock() so coinbase txs do not have the same txid.
Update test data in miner_tests.
2016-07-26 17:13:03 -07:00
Simon 10d2c57c0d Replace calls to GetHash() with GetTxid() for transaction objects.
Where the caller intends to receive a transaction id and not a double
SHA256 hash.
2016-07-26 17:13:03 -07:00
Simon 2b9130cd1f Update precomputed equihash solutions used in test. 2016-07-26 17:09:27 -07:00
Jack Grigg 2dbabb1159 Make Equihash solvers cancellable
The miner only cancels the solver when chainActive.Tip() changes.

Closes #1055
2016-07-20 19:17:02 +12:00
zkbot 1178df0883 Auto merge of #1004 - str4d:931-difficulty-algorithm, r=ebfull
Implement new difficulty algorithm

Closes #931. Closes #696.
2016-06-15 23:26:49 +00:00
Jack Grigg 5e207f4ea5 Improve comments per review 2016-06-16 10:45:19 +12:00
zkbot 6793168a2e Auto merge of #1017 - ebfull:coinbase-must-be-protected, r=ebfull
Enforce that coinbases must be protected

This PR forces miners to place their funds in the private value transfer system, making "transparent coins" opt-in for users, and increasing privacy for all participants on a systemic level.

Closes #101.
2016-06-15 03:06:23 +00:00
Jack Grigg 284e125957 Update tests for new difficulty algorithm 2016-06-15 13:44:27 +12:00
Sean Bowe d212ba320b Disable enforced coinbase protection in miner_tests. 2016-06-14 15:18:52 -06:00
Sean Bowe 542da618df Enforce remaining softfork activation rules unconditionally. 2016-06-14 12:34:38 -06:00
Jack Grigg f3aee6b109 Update miner tests for platform-independent Equihash 2016-06-12 00:00:26 +12:00
Jack Grigg 1dd8ce9ba5 Update tests to account for new Equihash parameters 2016-06-11 15:45:55 +12:00
Jack Grigg a59c352cfd Update tests to account for decreased block interval 2016-06-10 12:02:47 +12:00
Jack Grigg 50121909aa Update tests to account for reserved field 2016-06-07 22:45:41 +12:00
Jack Grigg 442eff615b Fix failing miner test 2016-05-12 00:01:24 +12:00
Jack Grigg 4f4a8c3c88 Update miner tests to account for mining slow start 2016-05-10 23:03:23 +12:00
Sean Bowe f3ffa3d27f Implementation of Founders' Reward.
All blocks before the first subsidy halving block, with the exception of
the genesis block, must contain an output which sends 20% of the block
subsidy value to a scriptPubKey `FOUNDERS_REWARD_SCRIPT`.
2016-04-08 14:40:28 -06:00
Sean Bowe e22df48519 Fix miner_tests to work with equihash 2016-04-08 22:16:29 +12:00
Jack Grigg fdda3c5085 Use Equihash for Proof-of-Work
The main and test networks are configured to use parameters that are currently
low-memory but usable with the basic solver; they will be increased once the
solver is optimised. The regtest network is configured to have extremely low
memory usage for speed.

Note that Bitcoin's double-hasher is used for the difficulty check. This does
not match the paper, but is simpler than changing the block header
serialization. Single hashing is kept for the EquiHash solver because there is
no requirement on execution time there, only on memory usage.
2016-04-08 13:56:00 +12:00
Mark Friedenbach f720c5fc9f
Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints
Transactions are not allowed in the memory pool or selected for inclusion in a block until their lock times exceed chainActive.Tip()->GetMedianTimePast(). However blocks including transactions which are only mature under the old rules are still accepted; this is *not* the soft-fork required to actually rely on the new constraint in production.
2015-10-23 21:33:51 +01:00
Suhas Daftuar 304892fc03
Be stricter in processing unrequested blocks
AcceptBlock will no longer process an unrequested block, unless it has not
been previously processed and has more work than chainActive.Tip()

Github-Pull: #5875
Rebased-From: 9be0e6837b878f72bd087ce32b7a2f2ffb2fd544
2015-06-03 16:23:46 +02:00
Peter Todd 75a4d512cf
Fix off-by-one error w/ nLockTime in the wallet
Previously due to an off-by-one error the wallet ignored
nLockTime-by-height transactions that would be valid in the next block
even though they are accepted into the mempool. The transactions
wouldn't show up until confirmed, nor would they be included in the
unconfirmed balance. Similar to the mempool behavior fix in 665bdd3b,
the wallet code was calling IsFinalTx() directly without taking into
account the fact that doing so tells you if the transaction could have
been mined in the *current* block, rather than the next block.

To fix this we strip IsFinalTx() of non-consensus-critical
functionality, removing the default arguments, and add CheckFinalTx() to
check if a transaction will be final in the next block.

Github-Pull: #6183
Rebased-From: 28bf06236d3b385e95fe26a7a742395b30efd6ee
2015-06-01 12:35:49 +02:00
jtimon da29ecbcc6 Consensus: MOVEONLY: Move CValidationState from main consensus/validation 2015-05-15 16:05:28 +02:00
Cory Fields a8cdaf5c96 checkpoints: move the checkpoints enable boolean into main
This pertains to app-state, so it doesn't make sense to handle inside the
checkpoint functions.
2015-04-30 23:14:48 -04:00
Wladimir J. van der Laan 48265f3cf4 Revert mining changes in #5957
This reverts commit e2edf95cd3 6b04508e37 0df67f1f7a,
except the changes to the RPC tests.

A `generate` RPC call is introduced based on the old code.
2015-04-10 07:51:27 +02:00
Pieter Wuille e2edf95cd3 Bugfix: make CreateNewBlock return pindexPrev 2015-04-01 11:47:10 -07:00
Pieter Wuille 51598b2631 Reinitialize state in between individual unit tests.
This changes the TestingSetup fixture to be per-unit-test rather than global.
Most tests don't need it, so it's only invoked in a few.
2015-03-03 09:01:46 -08:00
Michael Ford 78253fcbad Remove references to X11 licence 2014-12-16 15:56:50 +08:00
Wladimir J. van der Laan f24bcce2ac
Merge pull request #1816
b867e40 CreateNewBlock: Stick height in coinbase so we pass template sanity check (Luke Dashjr)
60755db submitblock: Check for duplicate submissions explicitly (Luke Dashjr)
bc6cb41 QA RPC tests: Add tests block block proposals (Luke Dashjr)
9765a50 Implement BIP 23 Block Proposal (Luke Dashjr)
3dcbb9b Abstract DecodeHexBlk and BIP22ValidationResult functions out of submitblock (Luke Dashjr)
132ea9b miner_tests: Disable checkpoints so they don't fail the subsidy-change test (Luke Dashjr)
df08a62 TestBlockValidity function for CBlock proposals (used by CreateNewBlock) (Luke Dashjr)
4ea1be7 CreateNewBlock and miner_tests: Also check generated template is valid by CheckBlockHeader, ContextualCheckBlockHeader, CheckBlock, and ContextualCheckBlock (Luke Dashjr)
a48f2d6 Abstract context-dependent block checking from acceptance (Luke Dashjr)
2014-11-24 14:43:10 +01:00
Luke Dashjr 132ea9b48f miner_tests: Disable checkpoints so they don't fail the subsidy-change test 2014-11-18 19:20:10 +00:00
Wladimir J. van der Laan 73b82a3089
Merge pull request #5162
d2e74c5 boost: moveonly: split CPubKey and friends to new files (Cory Fields)
78c228c boost: moveonly: move BIP32Hash to hash.h (Cory Fields)
900078a boost: moveonly: create eccryptoverify.h|cpp and move helper functions there (Cory Fields)
2014-11-04 09:26:45 +01:00
Wladimir J. van der Laan 84d26d3a36
Merge pull request #5106
1bea2bb Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and document it (Luke Dashjr)
d29a291 Rename RPC_TRANSACTION_* errors to RPC_VERIFY_* and use RPC_VERIFY_ERROR for submitblock (Luke Dashjr)
f877aaa Bugfix: submitblock: Use a temporary CValidationState to determine accurately the outcome of ProcessBlock, now that it no longer does the full block validity check (Luke Dashjr)
24e8896 Add CValidationInterface::BlockChecked notification (Luke Dashjr)
2014-11-03 12:22:45 +01:00
Cory Fields d2e74c55bd boost: moveonly: split CPubKey and friends to new files 2014-10-31 01:19:37 -04:00