Commit graph

64 commits

Author SHA1 Message Date
Ross Nicoll ce564e381a 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.
2019-07-13 22:25:22 +00:00
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
practicalswift 47782b49e6 Add Clang thread safety analysis annotations 2018-05-05 16:51:22 +02:00
Drew Rasmussen bb079a0e2c Remove unused variable in SortForBlock 2018-03-14 23:10:39 -07:00
Suhas Daftuar 0a22a52918 Use mempool's ancestor sort in transaction selection
Transaction selection for mining tracks ancestor feerates that are
modified based on transactions that have already been selected.  This
commit de-duplicates the code so that the ancestor feerate sorting used
by the mempool can also be directly applied to the miner.
2018-01-13 15:57:30 -05:00
Akira Takizawa 595a7bab23 Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
Suhas Daftuar 1ec0c0a01c Make boost::multi_index comparators const
This fixes compatibility with boost 1.66
2017-12-07 10:06:38 -05:00
MeshCollider 1a445343f6 scripted-diff: Replace #include "" with #include <> (ryanofsky)
-BEGIN VERIFY SCRIPT-
for f in \
  src/*.cpp \
  src/*.h \
  src/bench/*.cpp \
  src/bench/*.h \
  src/compat/*.cpp \
  src/compat/*.h \
  src/consensus/*.cpp \
  src/consensus/*.h \
  src/crypto/*.cpp \
  src/crypto/*.h \
  src/crypto/ctaes/*.h \
  src/policy/*.cpp \
  src/policy/*.h \
  src/primitives/*.cpp \
  src/primitives/*.h \
  src/qt/*.cpp \
  src/qt/*.h \
  src/qt/test/*.cpp \
  src/qt/test/*.h \
  src/rpc/*.cpp \
  src/rpc/*.h \
  src/script/*.cpp \
  src/script/*.h \
  src/support/*.cpp \
  src/support/*.h \
  src/support/allocators/*.h \
  src/test/*.cpp \
  src/test/*.h \
  src/wallet/*.cpp \
  src/wallet/*.h \
  src/wallet/test/*.cpp \
  src/wallet/test/*.h \
  src/zmq/*.cpp \
  src/zmq/*.h
do
  base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-
2017-11-16 08:23:01 +13:00
Gregory Maxwell 22fd04beb9 Remove nBlockMaxSize from miner opt struct as it is no longer used. 2017-09-18 23:40:38 +00:00
Matt Corallo ba206d2c63 Deprecate confusing blockmaxsize, fix getmininginfo output
* This removes block-size-limiting code in favor of GBT clients
  doing the limiting themselves (if at all).
* -blockmaxsize is deprecated and only used to calculate an implied
  blockmaxweight, addressing confusion from multiple users.
* getmininginfo's currentblocksize return value was returning
  garbage values, and has been removed, also removing a
  GetSerializeSize call in some block generation inner loops and
  potentially addressing some performance edge cases.
2017-09-11 15:51:25 -04:00
Dan Raviv 5ac072caa2 Fix boost headers included as user instead of system headers
In most of the project, boost headers are included as system headers.
Fix the few inconsistent places where they aren't.
2017-08-26 21:09:00 +03:00
practicalswift 64fb0ac016 Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
2017-08-16 16:33:25 +02:00
practicalswift 6e8c48dc59 Add const to methods that do not modify the object for which it is called 2017-07-25 13:46:52 +02:00
practicalswift 4087d9ea7c Remove unnecessary forward class declarations in header files 2017-06-12 20:37:43 +02:00
Wladimir J. van der Laan cde9b1a864
Merge #9959: Mining: Prevent slowdown in CreateNewBlock on large mempools
011124a Update benchmarking with package statistics (Suhas Daftuar)
42cd8c8 Add benchmarking for CreateNewBlock (Suhas Daftuar)
eed816a Mining: return early when block is almost full (Suhas Daftuar)

Tree-SHA512: c0d8f71e4e0441acf3f4ca12f8705e413b59b323659346a447145653def71710537fb4c6d80cad8e36d68b0aabf19c92e9eab7135a8897b053ed58720856cdda
2017-03-30 20:55:29 +02:00
Suhas Daftuar 011124a2b2 Update benchmarking with package statistics 2017-03-29 13:57:52 -04:00
Suhas Daftuar abe7b3d3ab Don't require segwit in getblocktemplate for segwit signalling or mining
Segwit's version bit will be signalled for all invocations of CreateNewBlock,
and not specifying segwit only will cause CreateNewBlock to skip transactions
with witness from being selected.
2017-03-14 06:43:37 -04:00
Wladimir J. van der Laan 30ff3a2fc9
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6d Update example bitcoin.conf (Alex Morcos)
7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos)
359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos)
f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos)
49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos)
0315888 [test] Remove priority from tests (Alex Morcos)
f838005 No longer allow "free" transactions (Alex Morcos)
ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos)
fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos)
400b151 [debug] Change -printpriority option (Alex Morcos)
272b25a [mining] Remove -blockprioritysize. (Alex Morcos)
12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos)
ddf58c7 wallet: Remove sendfree (MarcoFalke)

Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2017-03-07 19:30:23 +01:00
Alex Morcos 272b25a6a9 [mining] Remove -blockprioritysize.
Remove ability of mining code to fill part of a block with transactions sorted by coin age.
2017-02-27 11:23:50 -05:00
Pieter Wuille 48faf0bf63 Abstract out BlockAssembler options 2017-02-26 16:13:17 -08:00
Alex Morcos daec955fd6 Introduce -blockmintxfee 2017-01-04 13:24:19 -05: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
Wladimir J. van der Laan 744d2652dd
Merge #8223: [c++11] Use std::unique_ptr for block creation.
9fce062 [c++11] Use std::unique_ptr for block creation. (Daniel Kraft)
2016-10-18 21:16:08 +02:00
Suhas Daftuar 2c06bae39e Rename "block cost" to "block weight" 2016-07-18 13:28:26 -04:00
Suhas Daftuar 27362dda4d Remove -blockminsize option 2016-06-30 11:41:13 -04:00
Suhas Daftuar d2e46e1b5c Remove addScoreTxs() 2016-06-30 11:37:38 -04:00
Suhas Daftuar 6dd4bc289c Exclude witness transactions in addPackageTxs() pre-segwit activation 2016-06-30 11:24:32 -04:00
Suhas Daftuar f15c2cde45 CreateNewBlock: add support for size-accounting to addPackageTxs
Includes a change to not continue to use size-accounting in addScoreTxs
or addPackageTxs just because addPriorityTxs() is used.
2016-06-27 10:58:58 -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
Daniel Kraft 9fce0629b4 [c++11] Use std::unique_ptr for block creation.
CreateNewBlock returns a pointer for which the caller takes ownership.
Use std::unique_ptr to make this explicit and simplify handling of these
objects in getblocktemplate.
2016-06-18 19:38:28 +02:00
Suhas Daftuar c82a4e9a63 Use ancestor-feerate based transaction selection for mining
Includes changes by Pieter Wuille
2016-06-16 12:35:37 -04:00
Alex Morcos 4dc94d1036 Refactor CreateNewBlock to be a method of the BlockAssembler class 2016-05-18 14:11:12 -04:00
Leviathn 8d1de43f0c Remove internal miner
This code removes the internal miner which is only useful on Testnet.
This leaves the internal miner that is useful on RegTest intact.
2016-02-10 18:29:13 -08:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Luke Dashjr b966aa836a Constrain constant values to a single location in code 2015-11-28 18:47:29 +01:00
Jorge Timón 6bc9e4056b Chainparams: Explicit CChainParams arg for miner:
-BitcoinMiner
-CreateNewBlock
-GenerateBitcoins
-ProcessBlockFound
2015-11-11 13:21:17 +01:00
Luke Dashjr 5f9260f458 Bugfix: If genproclimit is omitted to RPC setgenerate, don't change it; also show correct default in getmininginfo 2015-10-01 23:16:42 +00:00
Daniel Kraft 69c3bde448 Add some const declarations where they are appropriate.
Declare some arguments of functions as "const" pointers where they are
not meant to be modified.
2015-08-08 18:18:41 +02:00
Wladimir J. van der Laan 2f746c6e8a
Merge pull request #6177
ef8dfe4 Prevent block.nTime from decreasing (Mark Friedenbach)
2015-08-06 12:01:21 +02:00
Jonas Schnelli d0fc10a844 detach wallet from miner 2015-06-30 21:45:46 +02:00
Mark Friedenbach ef8dfe41d1 Prevent block.nTime from decreasing
Under some circumstances it is possible for there to be a significant,
discontinuous jump in a node's clock value. On mining nodes, this can
result in block templates which are no longer valid due to time-based
nLockTime constraints. UpdateTime() is modified so that it will never
decrease a block's nLockTime, thereby preventing such invalidations.
2015-05-27 14:03:11 -07:00
Jonas Schnelli 30c43d9821 miner.h: fix clang warning because of class/struct mix
- class 'Params' was previously declared as a struct
2015-04-16 10:32:47 +02:00
Jorge Timón bebe7282ff Chainparams: Refactor: Remove redundant AllowMinDifficultyBlocks() getter 2015-04-15 14:31:44 +02: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 6b04508e37 Introduce separate 'generate' RPC call 2015-04-01 11:47:10 -07:00
Wladimir J. van der Laan 40e96a3016
Merge pull request #5599
0cc0d8d Get rid of the internal miner's hashmeter (jtimon)
2015-01-24 16:00:40 +01:00
Luke Dashjr 2ce63d395f MOVEONLY: Move struct CBlockTemplate to miner.h (from main.h) 2015-01-12 20:47:44 +01:00
jtimon 0cc0d8d60b Get rid of the internal miner's hashmeter 2015-01-04 21:04:55 +01:00