Commit graph

175 commits

Author SHA1 Message Date
Ross Nicoll 9c6af6d841 Reduce recommended fees
* Reduce DEFAULT_FALLBACK_FEE to 1,000,000 Koinu. Note this by itself has no effect as the required fee is higher.
* Reduce wallet minimum fees to 0.01 DOGE
* Update DEFAULT_DUST_LIMIT
* Revise derived values after updating recommended fees
* Remove fee rounding from RPC tests
* Revert tests back to Bitcoin originals where possible
2021-09-03 10:52:24 +01:00
Ross Nicoll ce6e3d8137 Remove relay-only rounding
Remove rounding of transaction sizes when calculating fee minimums for relaying,
to simplify fee logic.
2021-08-17 08:50:42 +01:00
Ross Nicoll ec40df46b5 Check only the base block version (#1411)
Check only the base block version when looking for unexpected version numbers
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 fcde864334 Sync mining code from Namecore to resolve unit test failures (#1385) 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 8c0468c2d2 Add Dogecoin block subsidy calculations. 2018-09-19 19:21:49 +01:00
Suhas Daftuar a296c6009f Update benchmarking with package statistics
Github-Pull: #9959
Rebased-From: 011124a2b2
2017-03-30 15:18:02 -04:00
Suhas Daftuar 10028fb555 Add benchmarking for CreateNewBlock
Github-Pull: #9959
Rebased-From: 42cd8c890f
2017-03-30 15:06:14 -04:00
Suhas Daftuar b5c3440b05 Mining: return early when block is almost full
Github-Pull: #9959
Rebased-From: eed816af6c
2017-03-30 15:05:33 -04:00
Suhas Daftuar 569596cc51 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.

Github-Pull: #9955
Rebased-From: abe7b3d3ab
2017-03-16 10:43:54 -04:00
Karl-Johan Alm b7b48c8bbd Refactor: Remove using namespace <xxx> from src/*.cpp. 2017-01-27 18:13:20 +09: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
Matt Corallo 0cf86a6678 Introduce (and use) an IsArgSet accessor method 2016-12-23 21:30:16 -05:00
Pieter Wuille f6fb7acda4 Move CTxInWitness inside CTxIn 2016-12-04 23:47:12 -08:00
Matt Corallo 76faa3cdfe Rename the remaining main.{h,cpp} to validation.{h,cpp} 2016-12-02 09:42:51 -08:00
Pieter Wuille b4e4ba475a Introduce convenience type CTransactionRef 2016-11-19 17:53:23 -08:00
Pieter Wuille 1662b437b3 Make CBlock::vtx a vector of shared_ptr<CTransaction> 2016-11-19 17:51:09 -08:00
Wladimir J. van der Laan f6db48ad1c
Merge #8838: Calculate size and weight of block correctly in CreateNewBlock()
5f274a1 log block size and weight correctly. (jnewbery)
2016-11-17 14:14:51 +01: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
jnewbery 5f274a1749 log block size and weight correctly. 2016-10-03 13:55:26 -04:00
Wladimir J. van der Laan 517eee3e8f
Merge #8362: Scale legacy sigop count in CreateNewBlock
682aa0f Scale legacy sigop count in CreateNewBlock (Suhas Daftuar)
2016-07-25 18:08:09 +02:00
Suhas Daftuar 2c06bae39e Rename "block cost" to "block weight" 2016-07-18 13:28:26 -04:00
Suhas Daftuar 682aa0f289 Scale legacy sigop count in CreateNewBlock 2016-07-18 12:42:41 -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 c2dd5a3c39 FIX: correctly measure size of priority block 2016-06-01 12:29:03 -04:00
Alex Morcos a278764748 FIX: Account for txs already added to block in addPriorityTxs 2016-05-24 15:01:14 -04:00
Alex Morcos 4dc94d1036 Refactor CreateNewBlock to be a method of the BlockAssembler class 2016-05-18 14:11:12 -04:00
Wladimir J. van der Laan 07e4edb056 auto_ptr → unique_ptr
Change the few occurrences of the deprecated `auto_ptr` to c++11 `unique_ptr`.
Silences the deprecation warnings.

Also add a missing `std::` for consistency.
2016-04-28 13:43:32 +02: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 11c769966a
Merge #7507: Remove internal miner
8d1de43 Remove internal miner (Leviathn)
2016-03-14 11:35:41 +01:00
Suhas Daftuar 086da92ea7 Add tags to mempool's mapTx indices 2016-02-16 12:35:16 -05: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
antonio-fr 74f7341fec Update miner.cpp: Fix typo in comment 2015-12-02 15:18:23 +01:00
Alex Morcos 553cad94e2 Rewrite CreateNewBlock
Use the score index on the mempool to only add sorted txs in order.  Remove much of the validation while building the block, relying on mempool to be consistent and only contain txs that can be mined.
The mempool is assumed to be consistent as far as not containing txs which spend non-existent outputs or double spends, and scripts are valid.  Finality of txs is still checked (except not coinbase maturity, assumed in mempool).
Still TestBlockValidity in case mempool consistency breaks and return error state if an invalid block was created.
Unit tests are modified to realize that invalid blocks can now be constructed if the mempool breaks its consistency assumptions and also updated to have the right fees, since the cached value is now used for block construction.

Conflicts:
	src/miner.cpp
2015-12-01 12:09:37 -05:00
Pieter Wuille 61457c29d7
Merge pull request #6508
eece63f Switch blocks to a constant-space Merkle root/branch algorithm. (Pieter Wuille)
ee60e56 Add merkle.{h,cpp}, generic merkle root/branch algorithm (Pieter Wuille)
2015-11-28 22:27:38 +01:00
Luke Dashjr b966aa836a Constrain constant values to a single location in code 2015-11-28 18:47:29 +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
Jorge Timón 6bc9e4056b Chainparams: Explicit CChainParams arg for miner:
-BitcoinMiner
-CreateNewBlock
-GenerateBitcoins
-ProcessBlockFound
2015-11-11 13:21:17 +01:00
Jorge Timón 598e494587 Chainparams: Explicit CChainParams arg for main (pre miner):
-ProcessNewBlock
-TestBlockValidity
2015-11-11 13:21:17 +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