aboutsummaryrefslogtreecommitdiff
path: root/src/test/miner_tests.cpp
AgeCommit message (Collapse)Author
2016-06-16Add unit tests for ancestor feerate miningSuhas Daftuar
2016-06-13Merge #7598: Refactor CreateNewBlock to be a method of the BlockAssembler classWladimir J. van der Laan
c2dd5a3 FIX: correctly measure size of priority block (Alex Morcos) a278764 FIX: Account for txs already added to block in addPriorityTxs (Alex Morcos) 4dc94d1 Refactor CreateNewBlock to be a method of the BlockAssembler class (Alex Morcos)
2016-06-07Do not shadow local variablesPavel Janík
2016-05-18Refactor CreateNewBlock to be a method of the BlockAssembler classAlex Morcos
2016-04-07Corrected valuesinstagibbs
2016-04-07Gave miner test values constants for less error-prone values.instagibbs
2016-03-15BIP9 ImplementationPieter Wuille
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and based on code by Jorge Timon.
2016-02-12Merge #7184: Implement SequenceLocks functions for BIP 68Wladimir J. van der Laan
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-10Implement SequenceLocks functionsAlex Morcos
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
2015-12-13Bump copyright headers to 2015MarcoFalke
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-12-01Merge pull request #6915Wladimir J. van der Laan
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)
2015-12-01Merge pull request #6914Wladimir J. van der Laan
114b581 Prevector type (Pieter Wuille)
2015-11-30Track coinbase spends in CTxMemPoolEntrySuhas Daftuar
This allows us to optimize CTxMemPool::removeForReorg.
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-16Implement helper class for CTxMemPoolEntry constructorAlex Morcos
This is only for unit tests.
2015-11-13Prevector typePieter Wuille
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-03Revert "Revert "Enable policy enforcing GetMedianTimePast as the end point ↵Gregory Maxwell
of lock-time constraints"" This reverts commit 8537ecdfc40181249ec37556015a99cfae4b21fd.
2015-11-01Revert "Enable policy enforcing GetMedianTimePast as the end point of ↵Gregory Maxwell
lock-time constraints" This reverts commit dea8d21fc63e9f442299c97010e4740558f4f037.
2015-10-23Enable policy enforcing GetMedianTimePast as the end point of lock-time ↵Mark Friedenbach
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.
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-07-23TRIVIAL: Missing includesJorge Timón
2015-06-10Merge pull request #6222Wladimir J. van der Laan
efd4444 Explicitly set tx.nVersion for the genesis block and mining tests (Mark Friedenbach)
2015-06-02Explicitly set tx.nVersion for the genesis block and mining testsMark Friedenbach
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).
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-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-15Consensus: MOVEONLY: Move CValidationState from main consensus/validationjtimon
2015-04-30checkpoints: move the checkpoints enable boolean into mainCory Fields
This pertains to app-state, so it doesn't make sense to handle inside the checkpoint functions.
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-03-03Reinitialize state in between individual unit tests.Pieter Wuille
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.
2014-12-16Remove references to X11 licenceMichael Ford
2014-11-24Merge pull request #1816Wladimir J. van der Laan
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)
2014-11-18miner_tests: Disable checkpoints so they don't fail the subsidy-change testLuke Dashjr
2014-11-04Merge pull request #5162Wladimir J. van der Laan
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)
2014-11-03Merge pull request #5106Wladimir J. van der Laan
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)
2014-10-31boost: moveonly: split CPubKey and friends to new filesCory Fields
2014-10-28Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and ↵Luke Dashjr
document it
2014-10-17script: move CScriptID to standard.h and add a ctor for creating them from ↵Cory Fields
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();
2014-10-02Switch testing framework from MAIN to new UNITTEST networkSergioDemianLerner
UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
2014-10-02Revert merge of pull #4845Wladimir J. van der Laan
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.
2014-09-29Switch testing framework from MAIN to new UNITTEST networkSergioDemianLerner
UNITTEST inherites from MAIN but allows synamically changing its parameters using the ModifiableParams() interface
2014-09-16Move CTxDestination from script/script to script/standardPieter Wuille
2014-06-21Add CMutableTransaction and make CTransaction immutable.Pieter Wuille
In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
2014-06-21Switch miner.cpp to use sha2 instead of OpenSSL.Pieter Wuille
2014-03-18Add licenses for tests and test dataWladimir J. van der Laan
- 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
2014-01-26Fix off-by-one errors in use of IsFinalTx()Peter Todd
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.