Commit graph

46 commits

Author SHA1 Message Date
Patrick Lodder 0c600d7f9d
Fixate BIP65 softfork heights
- Re-introduce Params.BIP65Height
- Fixate block 1854705 for testnet
- Fixate block 3464751 for mainnet
- Fixate block 1351 for regtest
- Stop using IsSuperMajority() in validation for BIP65
- Simplify RPC SoftForkMajorityDesc
2021-02-13 17:24:55 +01:00
Ross Nicoll 9c3a11b248 Clean up RPC tests (#1465)
* Enable full block tests
* Fix invalidblocktest
* Move watch only address funding to immediately before it's used, so node 0 doesn't spend the output before it checks it later.
* Fix `fundrawtransaction` tests and sanitize fee calculation at the same time
* Correct resolution of chain parameters when validating tx inputs, especially from previous coinbase transactions
* Set block versions on full block tests so that the generated blocks are AuxPoW compatible
2018-09-19 22:11:47 +01:00
Ross Nicoll 4d5e53e7b2 Initialise left/right consensus branches to null (#1435)
Strictly speaking the left/right consensus branches haven't been initialised so contain random values.
Most of the time these happen to be null, but sometimes causes client crashes (at least it does in 1.15, but fixing in earlier versions to be sure).
2018-09-19 21:09:16 +01:00
Ross Nicoll 7b81f4de0a Move COINBASE_MATURITY to the consensus parameters (#1426) 2018-09-19 21:09:16 +01:00
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 a89d54c4b2 Change BIP65/66 enforcement to match Dogecoin (#1403)
* Introduce first estimates at BIP lock-in blocks

* Introduce Dogecoin BIP parameters

* Re-introduce supermajority rules for BIP65

* Add BIP65 supermajority rules

* Tighten v3 block constraints

* Don't enforce coinbase in v2 blocks

* Correct testnet majority params

* Change to using base version when checking supermajority
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 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
practicalswift cc16d99f1d [trivial] Fix typos in comments 2017-01-27 21:22:35 +01:00
Gregory Maxwell e440ac7ef3 Introduce assumevalid setting to skip presumed valid scripts.
This disentangles the script validation skipping from checkpoints.

A new option is introduced "assumevalid" which specifies a block whos
 ancestors we assume all have valid scriptsigs and so we do not check
 them when they are also burried under the best header by two weeks
 worth of work.

Unlike checkpoints this has no influence on consensus unless you set
 it to a block with an invalid history.  Because of this it can be
 easily be updated without risk of influencing the network consensus.

This results in a massive IBD speedup.

This approach was independently recommended by Peter Todd and Luke-Jr
 since POW based signature skipping (see PR#9180) does not have the
 verifiable properties of a specific hash and may create bad incentives.

The downside is that, like checkpoints, the defaults bitrot and older
 releases will sync slower.  On the plus side users can provide their
 own value here, and if they set it to something crazy all that will
 happen is more time will be spend validating signatures.

Checkblocks and checklevel are also moved to the hidden debug options:
 Especially now that checkblocks has a low default there is little need
 to change these settings, and users frequently misunderstand them as
 influencing security or IBD speed.  By hiding them we offset the
 space added by this new option.
2017-01-13 15:42:24 +00: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
Pieter Wuille 1662b437b3 Make CBlock::vtx a vector of shared_ptr<CTransaction> 2016-11-19 17:51:09 -08:00
Gregory Maxwell fd46136dfa 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.
2016-11-02 01:47:02 +00:00
Pieter Wuille f9c23dea97 Define start and end time for segwit deployment 2016-10-17 14:15:57 +02:00
Wladimir J. van der Laan a5bb6387f7
Merge #8607: [doc] Fix doxygen off-by-one comments, fix typos
fafe7b3 contrib: Make fix-copyright-headers.py more portable (MarcoFalke)
fa27c0a [doc] Fix typos in comments, doxygen: Fix comment syntax (MarcoFalke)
fabfd5d [qa] pull-tester: Don't mute zmq ImportError (MarcoFalke)
67a5502 init: Fix typo in help message for -whitelistforcerelay (Wladimir J. van der Laan)
2016-08-28 16:06:03 +02:00
MarcoFalke fa27c0a2c4 [doc] Fix typos in comments, doxygen: Fix comment syntax 2016-08-22 10:51:41 +02:00
NicolasDorier 122786d0e0 Consensus: Remove ISM 2016-07-23 01:02:53 +09:00
Suhas Daftuar 2c06bae39e Rename "block cost" to "block weight" 2016-07-18 13:28:26 -04:00
Pieter Wuille 2b1f6f9ccf BIP141: Other consensus critical limits, and BIP145
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22 15:43:00 +02:00
Pieter Wuille 8b49040854 BIP141: Commitment structure and deployment
Includes a fix by Suhas Daftuar and LongShao007
2016-06-22 15:42:59 +02:00
Luke Dashjr d3df40e51a Implement BIP 9 GBT changes
- BIP9DeploymentInfo struct for static deployment info
- VersionBitsDeploymentInfo: Avoid C++11ism by commenting parameter names
- getblocktemplate: Make sure to set deployments in the version if it is LOCKED_IN
- In this commit, all rules are considered required for clients to support
2016-06-06 17:10:22 +00:00
Pieter Wuille 65751a3cf2 Add CHECKSEQUENCEVERIFY softfork through BIP9 2016-03-18 08:09:06 +00:00
Suhas Daftuar 532cbb22b5 Add testing of ComputeBlockVersion 2016-03-15 16:54:39 +01:00
Pieter Wuille 6851107b3a BIP9 Implementation
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and
based on code by Jorge Timon.
2016-03-15 16:54:38 +01:00
Wladimir J. van der Laan 80d1f2e483
Merge #7184: Implement SequenceLocks functions for BIP 68
b043c4b fix sdaftuar's nits again (Alex Morcos)
a51c79b Bug fix to RPC test (Alex Morcos)
da6ad5f Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar)
c6c2f0f Implement SequenceLocks functions (Alex Morcos)
2016-02-12 17:03:46 +01:00
Alex Morcos c6c2f0fd78 Implement SequenceLocks functions
SequenceLocks functions are used to evaluate sequence lock times or heights per BIP 68.

The majority of this code is copied from maaku in #6312
Further credit: btcdrak, sipa, NicolasDorier
2016-02-10 15:35:33 -05:00
MarcoFalke fa60d05a4e Add missing copyright headers 2016-01-05 21:34:15 +01:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Pieter Wuille eece63fa72 Switch blocks to a constant-space Merkle root/branch algorithm.
This switches the Merkle tree logic for blocks to one that runs in constant (small) space.
The old code is moved to tests, and a new test is added that for various combinations of
block sizes, transaction positions to compute a branch for, and mutations:
 * Verifies that the old code and new code agree for the Merkle root.
 * Verifies that the old code and new code agree for the Merkle branch.
 * Verifies that the computed Merkle branch is valid.
 * Verifies that mutations don't change the Merkle root.
 * Verifies that mutations are correctly detected.
2015-11-27 15:36:52 +01:00
Pieter Wuille ee60e5625b Add merkle.{h,cpp}, generic merkle root/branch algorithm 2015-11-27 15:31:01 +01:00
Pieter Wuille 54e8bfec83
Merge pull request #6931
33c90cf Make skipping BIP30 check chain agnostic (Alex Morcos)
06d81ad Skip BIP30 check after BIP34 activation (Alex Morcos)
2015-11-12 14:37:10 +01:00
Gregory Maxwell e4e5334ef8 Restore MedianTimePast for locktime.
Revert "Revert "Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations""
This reverts commit 40cd32e835.

After careful analysis it was determined that the change was, in fact, safe and several people were suffering
momentary confusion about locktime semantics.
2015-11-03 17:12:36 +00:00
Alex Morcos 33c90cf197 Make skipping BIP30 check chain agnostic 2015-11-02 20:11:55 -05:00
Gregory Maxwell 40cd32e835 Revert "Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations"
This reverts commit 9d55050773.

As noted by Luke-Jr, under some conditions this will accept transactions which are invalid by the network
 rules.  This happens when the current block time is head of the median time past and a transaction's
 locktime is in the middle.

This could be addressed by changing the rule to MAX(this_block_time, MTP+offset) but this solution and
 the particular offset used deserve some consideration.
2015-11-01 20:05:18 +00:00
Mark Friedenbach 9d55050773 Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations
The lock-time code currently uses CBlock::nTime as the cutoff point for time based locked transactions. This has the unfortunate outcome of creating a perverse incentive for miners to lie about the time of a block in order to collect more fees by including transactions that by wall clock determination have not yet matured. By using CBlockIndex::GetMedianTimePast from the prior block instead, the self-interested miner no longer gains from generating blocks with fraudulent timestamps. Users can compensate for this change by simply adding an hour (3600 seconds) to their time-based lock times.

If enforced, this would be a soft-fork change. This commit only adds the functionality on an unexecuted code path, without changing the behaviour of Bitcoin Core.
2015-10-23 09:02:24 -07:00
Eric Lombrozo 7801f4387d Added fPowNoRetargeting field to Consensus::Params that disables nBits recalculation. 2015-10-19 14:25:21 -04:00
Wladimir J. van der Laan fbf44e6f3e Add debug message to CValidationState for optional extra information
Add a field `strDebugMessage` which can be passed to DoS or Invalid,
and queried using GetDebugMessage() to add extra troubleshooting
information to the validation state.
2015-08-06 09:47:01 +02:00
Shaul Kfir a651403e09 Add absurdly high fee message to validation state (for RPC propagation) 2015-06-30 15:59:11 -04:00
Wladimir J. van der Laan 41076aad0c
Merge pull request #6124
ffd75ad Enable CHECKLOCKTIMEVERIFY as a standard script verify flag (Peter Todd)
bc60b2b Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65) (Peter Todd)
48e9c57 Move LOCKTIME_THRESHOLD to src/script/script.h (Peter Todd)
99088d6 Make CScriptNum() take nMaxNumSize as an argument (Peter Todd)
2015-06-26 14:42:45 +02:00
Philip Kaufmann a9ac95c1bc use const references where appropriate 2015-06-04 19:34:18 +02:00
jtimon da29ecbcc6 Consensus: MOVEONLY: Move CValidationState from main consensus/validation 2015-05-15 16:05:28 +02:00
Peter Todd 48e9c57cf0 Move LOCKTIME_THRESHOLD to src/script/script.h
Will now be needed by CHECKLOCKTIMEVERIFY code.
2015-05-09 04:33:49 -04:00
jtimon 691161d419 Consensus: Create consensus/consensus.h with some constants 2015-04-20 21:27:51 +02:00
Philip Kaufmann a21df62069 ensure consistent header comment naming conventions
- BITCOIN_FOLDER_SUBFOLDER_FILENAME_H
2015-04-20 13:29:22 +02: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
Jorge Timón bd006110fb Consensus: Refactor: Introduce Consensus::Params class 2015-03-25 20:39:26 +01:00