aboutsummaryrefslogtreecommitdiff
path: root/src/test/txvalidationcache_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace test data with Dogecoin valuesRoss Nicoll2019-04-031-2/+2
| | | | | | | | | | | | | | | | | | | | Replace test data with Dogecoin equivalents in the folowing tests: * base58 * bip32 * keys * miner * pow * wallet Replace RPC and deterministic signatures in unit tests with Dogecoin values. While conventionally I'd use an alternative implementation for these, as RFC 6979 compliant signature generation isn't terribly common, and there's no reason to suspect we've modified this code, I'm going to assert that it's good enough to test that the code doesn't provide different values. Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are replaced by the Dogecoin PoW tests.
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* speed up of tx_validationcache_tests by reusing of CTransaction.[email protected]2018-06-061-1/+1
| | | | The code was converting CMutableTransaction to CTransaction multiple times, which implies recalculating the hash multiple times. This commit fixes this by reusing a single CTransaction.
* Merge #13269: refactoring: Drop UpdateTransaction in favor of UpdateInputWladimir J. van der Laan2018-06-051-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6aa33feadbe11bfa505a80a691d84db966aca134 Drop UpdateTransaction in favor of UpdateInput (Ben Woosley) Pull request description: Updating the input explicitly requires the caller to present a mutable input, which more clearly communicates the effects and intent of the call (and, often, the enclosing loop). In most cases, this input is already immediately available and need not be looked up. Tree-SHA512: 8c7914a8b7ae975d8ad0e9d760e3c5da65776a5f79d060b8ffb6b3ff7a32235f71ad705f2185b368d9263742d7796bb562395d22b806d90e8502d8c496011e57
| * Drop UpdateTransaction in favor of UpdateInputBen Woosley2018-05-181-2/+2
| | | | | | | | | | | | | | | | Updating the input explicitly requires the caller to present a mutable input, which more clearly communicates the effects and intent of the method. In most cases, this input is already immediately available and need not be looked up.
* | Make CMutableTransaction constructor explicitMarcoFalke2018-05-041-1/+1
|/ | | | | Silently converting to a CMutableTransaction will drop all caches and should thus be done explicitly
* Make it clear which functions that are intended to be translation unit localpracticalswift2018-05-031-1/+1
| | | | | Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently.
* Merge #12949: tests: Avoid copies of CTransactionMarcoFalke2018-04-171-2/+2
|\ | | | | | | | | | | | | | | | | | | fae58eca93 tests: Avoid copies of CTransaction (MarcoFalke) Pull request description: Avoid the copy (or move) constructor of `CTransaction` in test code, whereever a simple reference can be used instead. Tree-SHA512: 8ef2077a277d6182996f4671722fdc01a90909ae7431c1e52604aab8ed028910615028caf9b4cb07a9b15fdc04939dea2209cc3189dde7d38271256d9fe1076c
| * tests: Avoid copies of CTransactionMarcoFalke2018-04-111-2/+2
| |
* | Merge #12803: Make BaseSignatureCreator a pure interfaceWladimir J. van der Laan2018-04-121-2/+2
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | be67831 Make DummySignatureCreator a singleton (Pieter Wuille) 190b8d2 Make BaseSignatureCreator a pure interface (Pieter Wuille) Pull request description: * Removes the `m_provider` field from `BaseSignatureCreator`. Instead both a `SigningProvider` (which provides keys and scripts) and a `BaseSignatureCreator` (which implements the transaction-specific (or other) signing logic) are passed into and down in `ProduceSignature`, making the two concepts orthogonal. * Makes `BaseSignatureCreator` a pure interface without constructor, making it easier to implement new derivations of it (for example for message signing). * As `DummySignatureCreator` now becomes a stateless object, turn it into a singleton `DUMMY_SIGNATURE_CREATOR`. Tree-SHA512: 5f1f4512e4ea7d02a31df7b9ede55008efa716c5b74a2630ca1c2fc6599584d8bf5f5641487266127f4b3788033803539fbd22b03ef1219c83c10da2d3da3dcd
| * Make BaseSignatureCreator a pure interfacePieter Wuille2018-04-101-2/+2
| |
* | test: Fix sign for expected valuesKarl-Johan Alm2018-04-111-3/+3
|/ | | | A number of BOOST_CHECK_EQUAL calls would result in warnings about signs.
* Merge #10742: scripted-diff: Use scoped enumerations (C++11, "enum class")Wladimir J. van der Laan2018-03-271-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1f45e21 scripted-diff: Convert 11 enums into scoped enums (C++11) (practicalswift) Pull request description: Rationale (from Bjarne Stroustrup's ["C++11 FAQ"](http://www.stroustrup.com/C++11FAQ.html#enum)): > > The enum classes ("new enums", "strong enums") address three problems with traditional C++ enumerations: > > * conventional enums implicitly convert to int, causing errors when someone does not want an enumeration to act as an integer. > * conventional enums export their enumerators to the surrounding scope, causing name clashes. > * the underlying type of an enum cannot be specified, causing confusion, compatibility problems, and makes forward declaration impossible. > > The new enums are "enum class" because they combine aspects of traditional enumerations (names values) with aspects of classes (scoped members and absence of conversions). Tree-SHA512: 9656e1cf4c3cabd4378c7a38d0c2eaf79e4a54d204a3c5762330840e55ee7e141e188a3efb2b4daf0ef3110bbaff80d8b9253abf2a9b015cdc4d60b49ac2b914
| * scripted-diff: Convert 11 enums into scoped enums (C++11)practicalswift2018-03-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/enum DBErrors/enum class DBErrors/g' src/wallet/walletdb.h git grep -l DB_ | xargs sed -i 's/DB_\(LOAD_OK\|CORRUPT\|NONCRITICAL_ERROR\|TOO_NEW\|LOAD_FAIL\|NEED_REWRITE\)/DBErrors::\1/g' sed -i 's/^ DBErrors::/ /g' src/wallet/walletdb.h sed -i 's/enum VerifyResult/enum class VerifyResult/g' src/wallet/db.h sed -i 's/\(VERIFY_OK\|RECOVER_OK\|RECOVER_FAIL\)/VerifyResult::\1/g' src/wallet/db.cpp sed -i 's/enum ThresholdState/enum class ThresholdState/g' src/versionbits.h git grep -l THRESHOLD_ | xargs sed -i 's/THRESHOLD_\(DEFINED\|STARTED\|LOCKED_IN\|ACTIVE\|FAILED\)/ThresholdState::\1/g' sed -i 's/^ ThresholdState::/ /g' src/versionbits.h sed -i 's/enum SigVersion/enum class SigVersion/g' src/script/interpreter.h git grep -l SIGVERSION_ | xargs sed -i 's/SIGVERSION_\(BASE\|WITNESS_V0\)/SigVersion::\1/g' sed -i 's/^ SigVersion::/ /g' src/script/interpreter.h sed -i 's/enum RetFormat {/enum class RetFormat {/g' src/rest.cpp sed -i 's/RF_\(UNDEF\|BINARY\|HEX\|JSON\)/RetFormat::\1/g' src/rest.cpp sed -i 's/^ RetFormat::/ /g' src/rest.cpp sed -i 's/enum HelpMessageMode {/enum class HelpMessageMode {/g' src/init.h git grep -l HMM_ | xargs sed -i 's/HMM_BITCOIN/HelpMessageMode::BITCOIN/g' sed -i 's/^ HelpMessageMode::/ /g' src/init.h sed -i 's/enum FeeEstimateHorizon/enum class FeeEstimateHorizon/g' src/policy/fees.h sed -i 's/enum RBFTransactionState/enum class RBFTransactionState/g' src/policy/rbf.h git grep -l RBF_ | xargs sed -i 's/RBF_TRANSACTIONSTATE_\(UNKNOWN\|REPLACEABLE_BIP125\|FINAL\)/RBFTransactionState::\1/g' sed -i 's/^ RBFTransactionState::/ /g' src/policy/rbf.h sed -i 's/enum BlockSource {/enum class BlockSource {/g' src/qt/clientmodel.h git grep -l BLOCK_SOURCE_ | xargs sed -i 's/BLOCK_SOURCE_\(NONE\|REINDEX\|DISK\|NETWORK\)/BlockSource::\1/g' sed -i 's/^ BlockSource::/ /g' src/qt/clientmodel.h sed -i 's/enum FlushStateMode {/enum class FlushStateMode {/g' src/validation.cpp sed -i 's/FLUSH_STATE_\(NONE\|IF_NEEDED\|PERIODIC\|ALWAYS\)/FlushStateMode::\1/g' src/validation.cpp sed -i 's/^ FlushStateMode::/ /g' src/validation.cpp sed -i 's/enum WitnessMode {/enum class WitnessMode {/g' src/test/script_tests.cpp sed -i 's/WITNESS_\(NONE\|PKH\|SH\)/WitnessMode::\1/g' src/test/script_tests.cpp sed -i 's/^ WitnessMode::/ /g' src/test/script_tests.cpp -END VERIFY SCRIPT-
* | Fix typosDimitris Apostolou2018-03-211-1/+1
|/
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* Require no cs_main lock for ProcessNewBlock/ActivateBestChainMatt Corallo2017-12-261-10/+11
| | | | | | This requires the removal of some very liberal (incorrect) cs_mains sprinkled in some tests. It adds some chainActive.Tip() races, but the tests are all single-threaded anyway.
* Merge #10699: Make all script validation flags backward compatibleWladimir J. van der Laan2017-12-121-14/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 01013f5 Simplify tx validation tests (Pieter Wuille) 2dd6f80 Add a test that all flags are softforks (Pieter Wuille) 2851b77 Make all script verification flags softforks (Pieter Wuille) Pull request description: This change makes `SCRIPT_VERIFY_UPGRADABLE_NOPS` not apply to `OP_CHECKLOCKTIMEVERIFY` and `OP_CHECKSEQUENCEVERIFY`. This is a no-op as `UPGRADABLE_NOPS` is only set for mempool transactions, and those always have `SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY` and `SCRIPT_VERIFY_CHECKSEQUENCEVERIFY` set as well. The advantage is that setting more flags now always results in a reduction in acceptable scripts (=softfork). This results in a nice and testable property for validation, for which a new test is added. This also means that the introduction of a new definition for a NOP or witness version will likely need the following procedure (example OP_NOP8 here) * Remove OP_NOP8 from being affected by `SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS`. * Add a `SCRIPT_VERIFY_DISCOURAGE_NOP8`, which only applies to `OP_NOP8`. * Add a `SCRIPT_VERIFY_NOP8` which implements the new consensus logic. * Before activation, add `SCRIPT_VERIFY_DISCOURAGE_NOP8` to the mempool flags. * After activation, add `SCRIPT_VERIFY_NOP8` to both the mempool and consensus flags. Tree-SHA512: d3b4538986ecf646aac9dba13a8d89318baf9e308e258547ca3b99e7c0509747f323edac6b1fea4e87e7d3c01b71193794b41679ae4f86f6e11ed6be3fd62c72
| * Simplify tx validation testsPieter Wuille2017-06-301-14/+8
| |
* | scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -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-
* | tests: Add missing locks to testspracticalswift2017-11-101-1/+5
| | | | | | | | | | | | Add missing locks to tests to satisfy lock requirements (such as EXCLUSIVE_LOCKS_REQUIRED(...) (Clang Thread Safety Analysis), AssertLockHeld(...) and implicit lock assumptions).
* | Use unique_ptr for pcoinscatcher/pcoinsdbview/pcoinsTip/pblocktreepracticalswift2017-11-091-9/+9
| | | | | | | | | | | | | | | | * pcoinscatcher (CCoinsViewErrorCatcher) * pcoinsdbview (CCoinsViewDB) * pcoinsTip (CCoinsViewCache) * pblocktree (CBlockTreeDB) * Remove variables shadowing pcoinsdbview
* | Change AcceptToMemoryPool function signatureAlex Morcos2017-09-121-1/+2
| | | | | | | | | | | | | | | | Combine fLimitFree and fOverrideMempoolLimit into a single boolean: bypass_limits. This is used to indicate that mempool limiting based on feerate should be bypassed. It is used when readding transactions from a reorg and then the mempool is trimmed to size after all transactions are added and they can be evaluated in the context of their descendants. No changes to behavior.
* | scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* | Do not shadow upper local variable `state`.Pavel Janík2017-07-081-1/+1
|/
* Add CheckInputs() unit testsSuhas Daftuar2017-06-271-0/+284
| | | | | | | Check that cached script execution results are only valid for the same script flags; that script execution checks are returned for non-cached transactions; and that cached results are only valid for transactions with the same witness hash.
* Make ATMP optionally return the CTransactionRefs it replacedMatt Corallo2017-01-091-1/+1
|
* Merge #9283: A few more CTransactionRef optimizationsWladimir J. van der Laan2017-01-041-1/+1
|\ | | | | | | | | | | | | 91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille) 6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille) 62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille) c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)
| * Make AcceptToMemoryPool take CTransactionRefPieter Wuille2016-12-211-1/+1
| |
* | Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
|/ | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Preserve tx version=1 for certain testsBtcDrak2016-12-081-0/+1
| | | | | Without this change, the tests would be affected by default tx version increases.
* Rename the remaining main.{h,cpp} to validation.{h,cpp}Matt Corallo2016-12-021-1/+1
|
* BIP143: Verification logicPieter Wuille2016-06-221-1/+1
| | | | Includes simplifications by Eric Lombrozo.
* Remove unneeded feerate param from RelayTransaction/AcceptToMemoryPool.Gregory Maxwell2016-05-161-1/+1
|
* Implement "feefilter" P2P message.Alex Morcos2016-03-211-1/+1
| | | | The "feefilter" p2p message is used to inform other nodes of your mempool min fee which is the feerate that any new transaction must meet to be accepted to your mempool. This will allow them to filter invs to you according to this feerate.
* Move maxTxFee out of mempoolMarcoFalke2016-02-021-1/+1
| | | | Also, remove default values in CMerkleTx::AcceptToMemoryPool()
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* Only call TrimToSize once per reorg/blocks disconnectMatt Corallo2015-10-131-1/+1
|
* Unit test doublespends in new blocksGavin Andresen2015-07-271-0/+86
As suggested by Greg Maxwell-- unit test to make sure a block with a double-spend in it doesn't pass validation if half of the double-spend is already in the memory pool (so full-blown transaction validation is skipped) when the block is received.