Commit graph

41 commits

Author SHA1 Message Date
Ross Nicoll 1be681a1b9 Modify chain consensus parameters to be height aware (#1396)
* Modify chain consensus parameters to be height aware
* Correct implementation of simplified rewards in parameters
* Correct max money
* Use base block version in IsSuperMajority() instead of full version
* Correct mining of blocks in AuxPoW tests
* Add in missing pre-AuxPoW consensus checks
2018-09-19 19:24:06 +01:00
Ross Nicoll 0a403a2227 Correct PoW calculation logic to use locally calcualted difficulty 2018-09-19 19:23:29 +01:00
Ross Nicoll 1de15c70ce Sync changes from Dogecoin 1.10 2018-09-19 19:23:29 +01:00
Ross Nicoll bc8cca4896 Merge AuxPoW support from Namecore
Changes are as below:

Wrap CBlockHeader::nVersion into a new class (CBlockVersion).  This allows to take care of interpreting the field into a base version, auxpow flag and the chain ID.

Update getauxblock.py for new 'generate' RPC call.

Add 'auxpow' to block JSON.

Accept auxpow as PoW verification.

Add unit tests for auxpow verification.

Add check for memory-layout of CBlockVersion.

Weaken auxpow chain ID checks for the testnet.

Allow Params() to overrule when to check the auxpow chain ID and for legacy blocks.  Use this to disable the checks on testnet.

Introduce CPureBlockHeader.

Split the block header part that is used by auxpow and the "real" block header (that uses auxpow) to resolve the cyclic dependency between the two.

Differentiate between uint256 and arith_uint256.

This change was done upstream, modify the auxpow code.

Add missing lock in auxpow_tests.

Fix REST header check for auxpow headers.

Those can be longer, thus take that into account.  Also perform the check actually on an auxpow header.

Correctly set the coinbase for getauxblock results.

Call IncrementExtraNonce in getauxblock so that the coinbase is actually initialised with the stuff it should be.  (BIP30 block height and COINBASE_FLAGS.)

Implement getauxblock plus regression test.

Turn auxpow test into FIXTURE test.

This allows using of the Params() calls.

Move CMerkleTx code to auxpow.cpp.

Otherwise we get linker errors when building without wallet.

Fix rebase with BIP66.

Update the code to handle BIP66's nVersion=3.

Enforce that auxpow parent blocks have no auxpow block version.

This is for compatibility with namecoind.  See also https://github.com/namecoin/namecoin/pull/199.

Move auxpow-related parameters to Consensus::Params.
2018-09-19 19:22:45 +01:00
Ross Nicoll f0f9fd0292 Add Dogecoin difficulty calculations 2018-09-19 19:21:49 +01:00
coblee 8279f81b44 Litecoin: Fix zeitgeist2 attack thanks to Lolcust and ArtForz. This fixes an issue where a 51% attack can change difficulty at will. Go back the full period unless it's the first retarget after genesis. 2018-09-19 19:21:49 +01:00
Ross Nicoll 64af132fdb Replace consensus values with Dogecoin equivalents
* Replace chain parameters with Dogecoin values
* Update maximum coins to match Dogecoin
* Disable version 2 block requirement
* Update coinbase maturity to match Dogecoin
2018-09-19 19:21:48 +01:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
21E14 c7aac2d557 Deprecating the remaining LogPrintf dependencies that were made obsolete in PR #7459. 2016-04-27 22:36:45 -04:00
Jorge Timón f3757a0391 Consensus: Decouple pow.cpp from util.h 2016-02-04 19:21:55 +01:00
Wladimir J. van der Laan 47ac04e8b1
Merge #7311: MOVEONLY: Move non-consensus functions out of pow
e867561 MOVEONLY: non-consensus: from pow to chain: (Jorge Timón)
2016-02-02 14:16:16 +01:00
Jorge Timón e86756193e MOVEONLY: non-consensus: from pow to chain:
- GetBlockProof
- GetBlockProofEquivalentTime
2016-01-12 13:43:14 +01:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Eric Lombrozo 7801f4387d Added fPowNoRetargeting field to Consensus::Params that disables nBits recalculation. 2015-10-19 14:25:21 -04:00
Pieter Wuille f7303f9793 Use equivalent PoW for non-main-chain requests 2015-04-22 03:53:25 -07:00
Cory Fields fd311996e8 consensus: don't use arith_uint256 in consensus.h
Requiring arith_uint256 at such a base level is not good for modularity.
2015-04-10 15:33:37 -04:00
Pieter Wuille 1cc0e96e9c Trivial optimization: use GetAncestor to compute new target 2015-03-26 11:06:27 -07:00
Jorge Timón d698ef690f Consensus: Refactor: Decouple pow.o from chainparams.o 2015-03-26 00:47:51 +01:00
Wladimir J. van der Laan 3aa0130b96 test: remove fSkipProofOfWork
Not used, and REGTEST already allows creating blocks at
the lowerst possible difficulty.
2015-03-09 16:09:54 +01:00
Ross Nicoll 34e5015cd2
Add unit tests for next difficulty calculations
Split GetNextWorkRequired() into two functions to allow the difficulty calculations to
be tested without requiring a full blockchain.
Add unit tests to cover basic difficulty calculation, plus each of the min/max actual
time, and maximum difficulty target conditions.
2015-02-21 13:14:19 +00:00
Shaul Kfir e5ece053da Rename Interval() to DifficultyAdjustmentInterval() 2015-02-17 08:46:51 -05:00
Pavel Janík 5262fde0ec Remove whitespaces before double colon in errors and logs 2015-01-31 17:38:28 -05:00
Wladimir J. van der Laan 734f85c4f0 Use arith_uint256 where necessary
Also add conversion from/to uint256 where needed.
2015-01-05 15:45:35 +01:00
sandakersmann f914f1a746
Added "Core" to copyright headers
Github-Pull: #5494
Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-19 19:55:32 +01:00
Michael Ford 78253fcbad Remove references to X11 licence 2014-12-16 15:56:50 +08:00
Luke Dashjr d227011184 MOVEONLY: core/ -> primitives/ 2014-12-03 10:52:58 +00:00
jtimon 092b58d13d CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> GetBlockProof(CBlockIndex) 2014-10-29 21:01:07 +01:00
jtimon 22c4272bf4 MOVEONLY: Move void UpdateTime() from pow.o to miner.o (plus fix include main.h -> chain.h) 2014-10-29 21:00:05 +01:00
jtimon 99f41b9cf7 MOVEONLY: core.o -> core/block.o 2014-10-27 13:54:37 +01:00
Pieter Wuille f244c99c96 Remove CheckMinWork, as we always know all parent headers 2014-10-14 15:42:01 -07:00
SergioDemianLerner f0fd00cb77 Switch testing framework from MAIN to new UNITTEST network
UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
2014-10-02 13:51:39 +02:00
Wladimir J. van der Laan 8d132431b4
Revert merge of pull #4845
It breaks the new mingw tests!

See

- https://travis-ci.org/bitcoin/bitcoin/jobs/36845581
- https://travis-ci.org/bitcoin/bitcoin/jobs/36845582

This reverts commit 4705902777, 5e2e7fcb99, a25fd6be13.
2014-10-02 10:39:55 +02:00
SergioDemianLerner a25fd6be13 Switch testing framework from MAIN to new UNITTEST network
UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
2014-09-29 13:03:22 +02:00
Pieter Wuille d1062e32fa
Merge pull request #4377
654871d replace ComputeMinWork with CheckMinWork (jtimon)
b343c1a Move CBlockIndex::GetBlockWork() to pow::GetProofIncrement(nBits) (jtimon)
c2c02f3 Move UpdateTime to pow (jtimon)
2014-08-27 22:39:28 +02:00
Wladimir J. van der Laan ad49c256c3 Split up util.cpp/h
Split up util.cpp/h into:

- string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach)
- money utilities (parsesmoney, formatmoney)
- time utilities (gettime*, sleep, format date):
- and the rest (logging, argument parsing, config file parsing)

The latter is basically the environment and OS handling,
and is stripped of all utility functions, so we may want to
rename it to something else than util.cpp/h for clarity (Matt suggested
osinterface).

Breaks dependency of sha256.cpp on all the things pulled in by util.
2014-08-26 13:25:22 +02:00
jtimon 654871d436 replace ComputeMinWork with CheckMinWork 2014-08-23 13:21:51 +02:00
jtimon b343c1a1e3 Move CBlockIndex::GetBlockWork() to pow::GetProofIncrement(nBits) 2014-08-23 13:21:51 +02:00
jtimon c2c02f3fa9 Move UpdateTime to pow 2014-08-23 13:21:50 +02:00
jtimon 209377a7cb Use GetBlockTime() more 2014-07-07 10:20:28 +02:00
jtimon fd704c7b2c move pow constants to chainparams 2014-06-23 23:10:24 +02:00
jtimon df852d2bcc Refactor proof of work related functions out of main 2014-06-23 23:10:24 +02:00