aboutsummaryrefslogtreecommitdiff
path: root/src/test/transaction_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* Remove redundant unused variablespracticalswift2018-07-181-1/+0
|
* Remove CombineSignatures and replace testsAndrew Chow2018-07-031-4/+13
| | | | | Removes CombineSignatures and replaces its use in tests with ProduceSignature to test the same behavior for ProduceSignature.
* Make SignatureData able to store signatures and scriptsAndrew Chow2018-07-031-4/+4
| | | | | | | | | | | | | | | | | In addition to having the scriptSig and scriptWitness, have SignatureData also be able to store just the signatures (pubkeys mapped to sigs) and scripts (script ids mapped to scripts). Also have DataFromTransaction be able to extract signatures and scripts from the scriptSig and scriptWitness of an input to put them in SignatureData. Adds a new SignatureChecker which takes a SignatureData and puts pubkeys and signatures into it when it successfully verifies a signature. Adds a new field in SignatureData which stores whether the SignatureData was complete. This allows us to also update the scriptSig and scriptWitness to the final one when updating a SignatureData with another one.
* Drop UpdateTransaction in favor of UpdateInputBen Woosley2018-05-181-4/+4
| | | | | | | | 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.
* Merge #11423: [Policy] Several transaction standardness rulesWladimir J. van der Laan2018-05-121-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | 364bae5 qa: Pad scriptPubKeys to get minimum sized txs (MarcoFalke) 7485488 Policy to reject extremely small transactions (Johnson Lau) 0f8719b Add transaction tests for constant scriptCode (Johnson Lau) 9dabfe4 Add constant scriptCode policy in non-segwit scripts (Johnson Lau) Pull request description: This disables `OP_CODESEPARATOR` in non-segwit scripts (even in an unexecuted branch), and makes a positive `FindAndDelete` result invalid. This ensures that the `scriptCode` serialized in `SignatureHash` is always the same as the script passing to the `EvalScript`. Tree-SHA512: a0552cb920294d130251c48053fa2ff1fbdd26332e62b52147d918837852750f0ce35ce2cd1cbdb86588943312f8154ccb4925e850dbb7c2254bc353070cd5f8
| * Add transaction tests for constant scriptCodeJohnson Lau2018-05-051-0/+1
| | | | | | | | Tests showing that CONST_SCRIPTCODE is applied only to non-segwit transactions
* | Make it clear which functions that are intended to be translation unit localpracticalswift2018-05-031-3/+3
|/ | | | | Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently.
* scripted-diff: Convert 11 enums into scoped enums (C++11)practicalswift2018-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -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-
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* test: refactor: Use absolute include paths for test data filesWladimir J. van der Laan2017-11-161-2/+2
|
* scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -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-
* [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheckJohnson Lau2017-08-301-2/+1
|
* Remove factor of 3 from definition of dust.Alex Morcos2017-07-171-5/+5
| | | | | | | | | | | | | | | This redefines dust to be the value of an output such that it would cost that value in fees to (create and) spend the output at the dust relay rate. The previous definition was that it would cost 1/3 of the value. The default dust relay rate is correspondingly increased to 3000 sat/kB so the actual default dust output value of 546 satoshis for a non-segwit output remains unchanged. This commit is a refactor only unless a dustrelayfee is passed on the commandline in which case that number now needs to be increased by a factor of 3 to get the same behavior. -dustrelayfee is a hidden command line option. Note: It's not exactly a refactor due to edge case changes in rounding as evidenced by the required change to the unit test.
* scripted-diff: Remove #include <boost/foreach.hpp>Jorge Timón2017-06-221-1/+0
| | | | | | -BEGIN VERIFY SCRIPT- sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp -END VERIFY SCRIPT-
* Merge #10502: scripted-diff: Remove BOOST_FOREACH, Q_FOREACH and PAIRTYPEPieter Wuille2017-06-131-2/+2
|\ | | | | | | | | | | | | | | | | 1238f13cf scripted-diff: Remove PAIRTYPE (Jorge Timón) 18dc3c396 scripted-diff: Remove Q_FOREACH (Jorge Timón) 7c00c2672 scripted-diff: Fully remove BOOST_FOREACH (Jorge Timón) a5410ac5e Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal (Jorge Timón) Tree-SHA512: d3ab4a173366402e7dcef31608977b757d4aa07abbbad2ee1bcbcfa311e994a4552f24e5a55272cb22c2dcf89a4b0495e02e9d9aceae4b08c0bab668f20e324c
| * scripted-diff: Fully remove BOOST_FOREACHJorge Timón2017-06-051-2/+2
| | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
* | Use list initialization (C++11) for maps/vectors instead of ↵practicalswift2017-06-061-20/+19
|/ | | | boost::assign::map_list_of/list_of
* Switch CScriptCheck to use Coin instead of CCoinsPieter Wuille2017-06-011-7/+8
|
* Only pass things committed to by tx's witness hash to CScriptCheckMatt Corallo2017-06-011-1/+2
| | | | | | | | | This clarifies a bit more the ways in which the new script execution cache could break consensus in the future if additional data from the CCoins object were to be used as a part of script execution. After this change, any such consensus breaks should be very visible to reviewers, hopefully ensuring no such changes can be made.
* Switch from per-tx to per-txout CCoinsViewCache methods in some placesPieter Wuille2017-06-011-2/+2
|
* Remove/ignore tx version in utxo and undoPieter Wuille2017-05-261-1/+0
| | | | | | | | | | | | | | | | | | | This makes the following changes: * In undo data and the chainstate database, the transaction nVersion field is removed from the data structures, always written as 0, and ignored when reading. * The definition of hash_serialized in gettxoutsetinfo is changed to no longer incude the nVersion field. It is renamed to hash_serialized_2 to avoid confusion. The new definition also includes transaction height and coinbase information, as this information was missing before. This depends on having a CHashVerifier-based undo data checksum verifier. Apart from changing the definition of serialized_hash, downgrading after using this patch is supported, as no release ever used the value of nVersion field in UTXO entries.
* MOVEONLY: tx functions to consensus/tx_verify.oJorge Timón2017-04-061-1/+2
| | | | Functions related to transaction verification.
* Merge #9555: [test] Avoid reading a potentially uninitialized variable in ↵MarcoFalke2017-03-071-1/+3
|\ | | | | | | | | | | | | | | tx_invalid-test (transaction_tests.cpp) 8455e36 [test] Avoid reading a potentially uninitialized variable in tx_invalid-test (practicalswift) Tree-SHA512: 1064cdd5c9e4612a05397a5880535d93dbb18dec4897b4bbda9e6ad78d30f4c72303e4d23159398f1b33545ff5819e739e374d7cde757e402b26c355268a2319
| * [test] Avoid reading a potentially uninitialized variable in tx_invalid-testpracticalswift2017-01-211-1/+3
| | | | | | | | | | | | | | Prior to this commit the err variable was not guaranteed to be set before the check ... BOOST_CHECK_MESSAGE(err != SCRIPT_ERR_OK, ScriptErrorString(err));
* | Merge #9380: Separate different uses of minimum feesWladimir J. van der Laan2017-01-161-3/+3
|\ \ | |/ |/| | | | | | | eb30d1a Introduce -dustrelayfee (Alex Morcos) 7b1add3 Introduce -incrementalrelayfee (Alex Morcos) daec955 Introduce -blockmintxfee (Alex Morcos)
| * Introduce -dustrelayfeeAlex Morcos2017-01-161-3/+3
| |
* | Refactoring: Removed using namespace <xxx> from bench/ and test/ source files.Karl-Johan Alm2017-01-021-41/+39
|/
* Move CTxInWitness inside CTxInPieter Wuille2016-12-041-13/+4
|
* Make CTransaction actually immutablePieter Wuille2016-12-021-26/+24
|
* Rename the remaining main.{h,cpp} to validation.{h,cpp}Matt Corallo2016-12-021-1/+1
|
* Require compressed keys in segwit as policy and disable signing with ↵Johnson Lau2016-10-161-26/+10
| | | | uncompressed keys for segwit scripts
* Add policy: null signature for failed CHECK(MULTI)SIGJohnson Lau2016-09-271-0/+1
|
* Make non-minimal OP_IF/NOTIF argument non-standard for P2WSHJohnson Lau2016-09-231-0/+1
|
* Rename to PrecomputedTransactionDataPieter Wuille2016-08-261-6/+6
|
* Unit test for sighash cachingNicolas DORIER2016-08-161-0/+81
|
* Precompute sighashesPieter Wuille2016-08-161-2/+4
| | | | Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.
* [qa] Add transaction tests for segwitNicolasDorier2016-06-221-10/+30
| | | | Including BIP143 P2WSH examples by jl2012.
* [qa] Witness version 0 signing unit testsPieter Wuille2016-06-221-0/+276
|
* Refactor script validation to observe amountsPieter Wuille2016-06-221-2/+4
| | | | This is a preparation for BIP143 support.
* BIP141: Witness programPieter Wuille2016-06-221-2/+2
|
* BIP144: Serialization, hashes, relay (sender side)Pieter Wuille2016-06-221-1/+1
| | | | | | Contains refactorings by Eric Lombrozo. Contains fixup by Nicolas Dorier. Contains cleanup of CInv::GetCommand by Alex Morcos
* BIP112: Implement CHECKSEQUENCEVERIFYMark Friedenbach2016-02-141-1/+2
| | | | | | | | | | - Replace NOP3 with CHECKSEQUENCEVERIFY (BIP112) <nSequence> CHECKSEQUENCEVERIFY -> <nSequence> - Fails if txin.nSequence < nSequence, allowing funds of a txout to be locked for a number of blocks or a duration of time after its inclusion in a block. - Pull most of CheckLockTime() out into VerifyLockTime(), a local function that will be reused for CheckSequence() - Add bitwise AND operator to CScriptNum - Enable CHECKSEQUENCEVERIFY as a standard script verify flag - Transactions that fail CSV verification will be rejected from the mempool, making it easy to test the feature. However blocks containing "invalid" CSV-using transactions will still be accepted; this is *not* the soft-fork required to actually enable CSV for production use.
* Get rid of inaccurate ScriptSigArgsExpectedPieter Wuille2016-02-011-8/+0
| | | | (cherry picked from commit 52b29dca7670c3f6d2ab918c0fff1d17c4e494ad)
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* [trivial] New DEFAULT_MIN_RELAY_TX_FEE = 1000MarcoFalke2015-11-091-1/+1
|
* transaction_tests: Be more strict checking dustMarcoFalke2015-11-091-2/+17
| | | | | | * Don't allow off-by-one or more * Make clear dust is coupled with minRelayTxFee * Check rounding for odd values
* tests: update transaction_tests for new dust thresholdWladimir J. van der Laan2015-10-101-1/+1
|
* Accept any sequence of PUSHDATAs in OP_RETURN outputsPeter Todd2015-10-011-2/+19
| | | | | | | | | | | | Previously only one PUSHDATA was allowed, needlessly limiting applications such as matching OP_RETURN contents with bloom filters that operate on a per-PUSHDATA level. Now any combination that passes IsPushOnly() is allowed, so long as the total size of the scriptPubKey is less than 42 bytes. (unchanged modulo non-minimal PUSHDATA encodings) Also, this fixes the odd bug where previously the PUSHDATA could be replaced by any single opcode, even sigops consuming opcodes such as CHECKMULTISIG. (20 sigops!)
* [Univalue] add univalue over subtreeJonas Schnelli2015-10-011-1/+1
| | | | similar to secp256k1 include and compile univalue over a subtree