aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
AgeCommit message (Collapse)Author
2016-01-05Bump copyright headers to 2015MarcoFalke
- Bump copyright headers to 2015 - [devtools] Rewrite fix-copyright-headers.py - [devtools] Use git pretty-format for year parsing Github-Pull: #7205 Rebased-From: fa6ad855e9159b2247da4fa0054f32fa181499ab fa24439ff3d8ab5b9efaf66ef4dae6713b88cb35 fa71669452e57039e4270fd2b33a0e0e1635b813
2015-12-02Update miner.cpp: Fix typo in commentantonio-fr
2015-12-01Rewrite CreateNewBlockAlex Morcos
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-11-28Merge pull request #6508Pieter Wuille
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-28Constrain constant values to a single location in codeLuke Dashjr
2015-11-27Switch blocks to a constant-space Merkle root/branch algorithm.Pieter Wuille
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-11Chainparams: Explicit CChainParams arg for miner:Jorge Timón
-BitcoinMiner -CreateNewBlock -GenerateBitcoins -ProcessBlockFound
2015-11-11Chainparams: Explicit CChainParams arg for main (pre miner):Jorge Timón
-ProcessNewBlock -TestBlockValidity
2015-11-03Restore MedianTimePast for locktime.Gregory Maxwell
Revert "Revert "Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations"" This reverts commit 40cd32e835092c3158175511da5193193ec54939. 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-01Revert "Add rules--presently disabled--for using GetMedianTimePast as ↵Gregory Maxwell
endpoint for lock-time calculations" This reverts commit 9d55050773d57c0e12005e524f2e54d9e622c6e2. 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-10-23Add rules--presently disabled--for using GetMedianTimePast as endpoint for ↵Mark Friedenbach
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-09-22Do not store Merkle branches in the wallet.Pieter Wuille
Assume that when a wallet transaction has a valid block hash and transaction position in it, the transaction is actually there. We're already trusting wallet data in a much more fundamental way anyway. To prevent backward compatibility issues, a new record is used for storing the block locator in the wallet. Old wallets will see a wallet file synchronized up to the genesis block, and rescan automatically.
2015-09-19TxMemPool: Change mapTx to a boost::multi_index_containerAshley Holman
Indexes on: - Tx Hash - Fee Rate (fee-per-kb)
2015-08-18Fix crash when mining with empty keypool.Daniel Kraft
Since the introduction of the ScriptForMining callback, the mining functions (setgenerate and generate) crash with an assertion failure (due to a NULL pointer script returned) if the keypool is empty. Fix this by giving a proper error.
2015-08-08Add some const declarations where they are appropriate.Daniel Kraft
Declare some arguments of functions as "const" pointers where they are not meant to be modified.
2015-08-06Merge pull request #6177Wladimir J. van der Laan
ef8dfe4 Prevent block.nTime from decreasing (Mark Friedenbach)
2015-07-23TRIVIAL: Missing includesJorge Timón
2015-07-10Merge pull request #6370Wladimir J. van der Laan
6ebac07 Remove ChainParams::DefaultMinerThreads (Wladimir J. van der Laan)
2015-07-06Merge pull request #6335Wladimir J. van der Laan
9238ecb Policy: MOVEONLY: 3 functions to policy.o: (Luke Dashjr) 627b9de Policy: MOVEONLY: Create policy/policy.h with some constants (Jorge Timón)
2015-07-03Remove ChainParams::DefaultMinerThreadsWladimir J. van der Laan
No longer relevant after #5957. This hack existed because of another hack where the numthreads parameter, on regtest, doubled as how many blocks to generate.
2015-07-02Merge pull request #6361Wladimir J. van der Laan
4716267 Use real number of cores for default -par, ignore virtual cores (Wladimir J. van der Laan)
2015-07-01Use real number of cores for default -par, ignore virtual coresWladimir J. van der Laan
To determine the default for `-par`, the number of script verification threads, use [boost::thread::physical_concurrency()](http://www.boost.org/doc/libs/1_58_0/doc/html/thread/thread_management.html#thread.thread_management.thread.physical_concurrency) which counts only physical cores, not virtual cores. Virtual cores are roughly a set of cached registers to avoid context switches while threading, they cannot actually perform work, so spawning a verification thread for them could even reduce efficiency and will put undue load on the system. Should fix issue #6358, as well as some other reported system overload issues, especially on Intel processors. The function was only introduced in boost 1.56, so provide a utility function `GetNumCores` to fall back for older Boost versions.
2015-07-01miner: rename UpdateRequestCount signal to ResetRequestCountJonas Schnelli
2015-07-01add CReserveScript to allow modular script keeping/returningJonas Schnelli
- use one CReserveScript per mining thread
2015-06-30detach wallet from minerJonas Schnelli
2015-06-26Policy: MOVEONLY: Create policy/policy.h with some constantsJorge Timón
2015-06-02Be stricter in processing unrequested blocksSuhas Daftuar
AcceptBlock will no longer process an unrequested block, unless it has not been previously processed and has more work than chainActive.Tip()
2015-06-01Merge pull request #6183Wladimir J. van der Laan
28bf062 Fix off-by-one error w/ nLockTime in the wallet (Peter Todd)
2015-05-27Prevent block.nTime from decreasingMark Friedenbach
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-27Merge pull request #5669Wladimir J. van der Laan
da29ecb Consensus: MOVEONLY: Move CValidationState from main consensus/validation (jtimon) 27afcd8 Consensus: Refactor: Decouple CValidationState from main::AbortNode() (Cory Fields)
2015-05-27Fix off-by-one error w/ nLockTime in the walletPeter Todd
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.
2015-05-15Chainparams: Refactor: Decouple main::GetBlockValue() from Params() [renamed ↵Jorge Timón
GetBlockSubsidy] Remove redundant getter CChainParams::SubsidyHalvingInterval()
2015-05-15Consensus: MOVEONLY: Move CValidationState from main consensus/validationjtimon
2015-05-12Avoid crash on start in TestBlockValidity with gen=1.Gregory Maxwell
When the internal miner is enabled at the start of a new node, there is an near instant assert in TestBlockValidity because its attempting to mine a block before the top checkpoint. Also avoids a data race around vNodes.
2015-04-20Consensus: Create consensus/consensus.h with some constantsjtimon
2015-04-15Chainparams: Refactor: Remove redundant AllowMinDifficultyBlocks() getterJorge Timón
2015-04-10Revert mining changes in #5957Wladimir J. van der Laan
This reverts commit e2edf95cd3f43331843676e49a82830128a95050 6b04508e37c5dd18cec1cd61cc4356bd208aa991 0df67f1f7ab4adfe9f0b3ba6276e737b37826464, except the changes to the RPC tests. A `generate` RPC call is introduced based on the old code.
2015-04-01Bugfix: make CreateNewBlock return pindexPrevPieter Wuille
2015-04-01Introduce separate 'generate' RPC callPieter Wuille
2015-04-01Simplify hash loop codePieter Wuille
2015-03-26Consensus: Refactor: Decouple pow.o from chainparams.oJorge Timón
2015-03-12[Move Only] Move wallet related things to src/wallet/Jonas Schnelli
could once be renamed from /src/wallet to /src/legacywallet.
2015-01-31Remove whitespaces before double colon in errors and logsPavel Janík
2015-01-24Merge pull request #5599Wladimir J. van der Laan
0cc0d8d Get rid of the internal miner's hashmeter (jtimon)
2015-01-12MOVEONLY: Move struct CBlockTemplate to miner.h (from main.h)Luke Dashjr
2015-01-05Use arith_uint256 where necessaryWladimir J. van der Laan
Also add conversion from/to uint256 where needed.
2015-01-04Get rid of the internal miner's hashmeterjtimon
2015-01-02Remove declaration of no longer existent CheckWorkWladimir J. van der Laan
Also make ProcessBlockFound static as it is not used outside miner.cpp. Alternative implementation of #5549.
2014-12-27Decouple miner.o and txmempool.o from CTxUndojtimon
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60