aboutsummaryrefslogtreecommitdiff
path: root/src/test/miner_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rewrite CreateNewBlockAlex Morcos2015-12-011-24/+36
| | | | | | | | | | 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
* Merge pull request #6915Wladimir J. van der Laan2015-12-011-11/+13
|\ | | | | | | | | | | | | | | | | | | | | 2d8860e Fix removeForReorg to use MedianTimePast (Suhas Daftuar) b7fa4aa Don't call removeForReorg if DisconnectTip fails (Suhas Daftuar) 7e49f5f Track coinbase spends in CTxMemPoolEntry (Suhas Daftuar) bb8ea1f removeForReorg calls once-per-disconnect-> once-per-reorg (Matt Corallo) 474b84a Make indentation in ActivateBestChainStep readable (Matt Corallo) b0a064c Fix comment in removeForReorg (Matt Corallo) 9b060e5 Fix removal of time-locked transactions during reorg (Matt Corallo) 0c9959a Add failing test checking timelocked-txn removal during reorg (Matt Corallo)
| * Track coinbase spends in CTxMemPoolEntrySuhas Daftuar2015-11-301-11/+13
| | | | | | | | This allows us to optimize CTxMemPool::removeForReorg.
* | Merge pull request #6914Wladimir J. van der Laan2015-12-011-1/+1
|\ \ | |/ |/| | | 114b581 Prevector type (Pieter Wuille)
| * Prevector typePieter Wuille2015-11-131-1/+1
| |
* | Switch blocks to a constant-space Merkle root/branch algorithm.Pieter Wuille2015-11-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Implement helper class for CTxMemPoolEntry constructorAlex Morcos2015-11-161-12/+16
| | | | | | | | This is only for unit tests.
* | Chainparams: Explicit CChainParams arg for miner:Jorge Timón2015-11-111-13/+13
| | | | | | | | | | | | | | -BitcoinMiner -CreateNewBlock -GenerateBitcoins -ProcessBlockFound
* | Chainparams: Explicit CChainParams arg for main (pre miner):Jorge Timón2015-11-111-1/+2
|/ | | | | -ProcessNewBlock -TestBlockValidity
* Revert "Revert "Enable policy enforcing GetMedianTimePast as the end point ↵Gregory Maxwell2015-11-031-3/+4
| | | | | | of lock-time constraints"" This reverts commit 8537ecdfc40181249ec37556015a99cfae4b21fd.
* Revert "Enable policy enforcing GetMedianTimePast as the end point of ↵Gregory Maxwell2015-11-011-4/+3
| | | | | | lock-time constraints" This reverts commit dea8d21fc63e9f442299c97010e4740558f4f037.
* Enable policy enforcing GetMedianTimePast as the end point of lock-time ↵Mark Friedenbach2015-10-231-3/+4
| | | | | | constraints Transactions are not allowed in the memory pool or selected for inclusion in a block until their lock times exceed chainActive.Tip()->GetMedianTimePast(). However blocks including transactions which are only mature under the old rules are still accepted; this is *not* the soft-fork required to actually rely on the new constraint in production.
* Do not store Merkle branches in the wallet.Pieter Wuille2015-09-221-1/+1
| | | | | | | | | | 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.
* TRIVIAL: Missing includesJorge Timón2015-07-231-0/+5
|
* Merge pull request #6222Wladimir J. van der Laan2015-06-101-0/+1
|\ | | | | | | efd4444 Explicitly set tx.nVersion for the genesis block and mining tests (Mark Friedenbach)
| * Explicitly set tx.nVersion for the genesis block and mining testsMark Friedenbach2015-06-021-0/+1
| | | | | | | | If/when CTransaction::CURRENT_VERSION is incremented, this will break CChainParams and the miner tests. This fix sets the transaction version explicitly where we depend on the hash value (genesis block, proof of work checks).
* | Be stricter in processing unrequested blocksSuhas Daftuar2015-06-021-1/+1
|/ | | | | AcceptBlock will no longer process an unrequested block, unless it has not been previously processed and has more work than chainActive.Tip()
* Merge pull request #6183Wladimir J. van der Laan2015-06-011-4/+6
|\ | | | | | | 28bf062 Fix off-by-one error w/ nLockTime in the wallet (Peter Todd)
| * Fix off-by-one error w/ nLockTime in the walletPeter Todd2015-05-271-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Consensus: MOVEONLY: Move CValidationState from main consensus/validationjtimon2015-05-151-0/+1
|/
* checkpoints: move the checkpoints enable boolean into mainCory Fields2015-04-301-2/+2
| | | | | This pertains to app-state, so it doesn't make sense to handle inside the checkpoint functions.
* Revert mining changes in #5957Wladimir J. van der Laan2015-04-101-14/+13
| | | | | | | This reverts commit e2edf95cd3f43331843676e49a82830128a95050 6b04508e37c5dd18cec1cd61cc4356bd208aa991 0df67f1f7ab4adfe9f0b3ba6276e737b37826464, except the changes to the RPC tests. A `generate` RPC call is introduced based on the old code.
* Bugfix: make CreateNewBlock return pindexPrevPieter Wuille2015-04-011-13/+14
|
* Reinitialize state in between individual unit tests.Pieter Wuille2015-03-031-1/+3
| | | | | This changes the TestingSetup fixture to be per-unit-test rather than global. Most tests don't need it, so it's only invoked in a few.
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Merge pull request #1816Wladimir J. van der Laan2014-11-241-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | b867e40 CreateNewBlock: Stick height in coinbase so we pass template sanity check (Luke Dashjr) 60755db submitblock: Check for duplicate submissions explicitly (Luke Dashjr) bc6cb41 QA RPC tests: Add tests block block proposals (Luke Dashjr) 9765a50 Implement BIP 23 Block Proposal (Luke Dashjr) 3dcbb9b Abstract DecodeHexBlk and BIP22ValidationResult functions out of submitblock (Luke Dashjr) 132ea9b miner_tests: Disable checkpoints so they don't fail the subsidy-change test (Luke Dashjr) df08a62 TestBlockValidity function for CBlock proposals (used by CreateNewBlock) (Luke Dashjr) 4ea1be7 CreateNewBlock and miner_tests: Also check generated template is valid by CheckBlockHeader, ContextualCheckBlockHeader, CheckBlock, and ContextualCheckBlock (Luke Dashjr) a48f2d6 Abstract context-dependent block checking from acceptance (Luke Dashjr)
| * miner_tests: Disable checkpoints so they don't fail the subsidy-change testLuke Dashjr2014-11-181-0/+2
| |
* | Merge pull request #5162Wladimir J. van der Laan2014-11-041-0/+1
|\ \ | |/ |/| | | | | | | d2e74c5 boost: moveonly: split CPubKey and friends to new files (Cory Fields) 78c228c boost: moveonly: move BIP32Hash to hash.h (Cory Fields) 900078a boost: moveonly: create eccryptoverify.h|cpp and move helper functions there (Cory Fields)
| * boost: moveonly: split CPubKey and friends to new filesCory Fields2014-10-311-0/+1
| |
* | Merge pull request #5106Wladimir J. van der Laan2014-11-031-1/+1
|\ \ | |/ |/| | | | | | | | | 1bea2bb Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and document it (Luke Dashjr) d29a291 Rename RPC_TRANSACTION_* errors to RPC_VERIFY_* and use RPC_VERIFY_ERROR for submitblock (Luke Dashjr) f877aaa Bugfix: submitblock: Use a temporary CValidationState to determine accurately the outcome of ProcessBlock, now that it no longer does the full block validity check (Luke Dashjr) 24e8896 Add CValidationInterface::BlockChecked notification (Luke Dashjr)
| * Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and ↵Luke Dashjr2014-10-281-1/+1
| | | | | | | | document it
* | script: move CScriptID to standard.h and add a ctor for creating them from ↵Cory Fields2014-10-171-1/+1
|/ | | | | | | | | | | | | | | | CScripts This allows for a reversal of the current behavior. This: CScript foo; CScriptID bar(foo.GetID()); Becomes: CScript foo; CScriptID bar(foo); This way, CScript is no longer dependent on CScriptID or Hash();
* Switch testing framework from MAIN to new UNITTEST networkSergioDemianLerner2014-10-021-0/+1
| | | | UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
* Revert merge of pull #4845Wladimir J. van der Laan2014-10-021-1/+0
| | | | | | | | | | | 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 470590277782cce2fe73275c74523aef59a51eab, 5e2e7fcb99738d9254d4030d53e4f711b2fc5ee0, a25fd6be138ff2bff7e2ad6a1a789db523c0193f.
* Switch testing framework from MAIN to new UNITTEST networkSergioDemianLerner2014-09-291-0/+1
| | | | UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
* Move CTxDestination from script/script to script/standardPieter Wuille2014-09-161-1/+1
|
* Add CMutableTransaction and make CTransaction immutable.Pieter Wuille2014-06-211-5/+7
| | | | | In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
* Switch miner.cpp to use sha2 instead of OpenSSL.Pieter Wuille2014-06-211-28/+0
|
* Add licenses for tests and test dataWladimir J. van der Laan2014-03-181-1/+3
| | | | | | | | - Add license headers to source files (years based on commit dates) in `src/test` as well as `qa` - Add `README.md` to `src/test/data` specifying MIT license Fixes #3848
* Fix off-by-one errors in use of IsFinalTx()Peter Todd2014-01-261-1/+50
| | | | | | | | | | | | | | Previously CreateNewBlock() didn't take into account the fact that IsFinalTx() without any arguments tests if the transaction is considered final in the *current* block, when both those functions really needed to know if the transaction would be final in the *next* block. Additionally the UI had a similar misunderstanding. Also adds some basic tests to check that CreateNewBlock() is in fact mining nLockTime-using transactions correctly. Thanks to Wladimir J. van der Laan for rebase.
* Make bitcoin compile without wallet if "db_cxx.h" is not presentThomas Holenstein2013-12-191-1/+0
| | | | | Moved includes of "db.h" into #ifdef ENABLE_WALLET blocks or remove them.
* Re-enable miner tests in --disable-wallet modeWladimir J. van der Laan2013-12-091-13/+12
| | | | | | Use a fixed script instead of a CReserveKey from the wallet. This does not affect the functionality or result of the tests as they never check the state of the wallet in the first place.
* Make unit tests succeed with -DDEBUG_LOCKORDERGavin Andresen2013-12-021-0/+2
|
* Add verbose boolean to getrawmempoolGavin Andresen2013-11-301-10/+10
| | | | | Also changes mempool to store CTxMemPoolEntries to keep track of when they enter/exit the pool.
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-3/+5
| | | | | | | | | Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
* Refactor/encapsulate chain globals into a CChain classPieter Wuille2013-10-111-6/+6
|
* Fix minor unit test memory leaksPieter Wuille2013-09-191-0/+4
|
* CreateNewBlock() now takes scriptPubKey argument,Jeff Garzik2013-08-241-11/+11
| | | | | | | rather than a key. CreateNewBlockWithKey() helper is added to restore existing functionality, making this an equivalent-transformation change.
* Move internal miner/block creation to separate miner.cpp module.Jeff Garzik2013-07-311-0/+1
| | | | Public functions referenced elsewhere are added to miner.h.
* CValidationState frameworkPieter Wuille2013-01-301-1/+3
|