aboutsummaryrefslogtreecommitdiff
path: root/test/util
AgeCommit message (Collapse)Author
2023-12-08tests: Add unit tests for bitcoin-tx replaceable commandKashif Smith
2023-05-22test: Make `util/test_runner.py` honor `BITCOINUTIL` and `BITCOINTX`Hennadii Stepanov
This change allows to drop in the executables via environment variables in the same way as for functional tests.
2023-02-22Merge bitcoin/bitcoin#25867: lint: enable E722 do not use bare exceptfanquake
61bb4e783b3acc62b121a228f6b14c2462e23315 lint: enable E722 do not use bare except (Leonardo Lazzaro) Pull request description: Improve test code and enable E722 lint check. If you want to catch all exceptions that signal program errors, use except Exception: (bare except is equivalent to except BaseException:). Reference: https://peps.python.org/pep-0008/#programming-recommendations ACKs for top commit: MarcoFalke: lgtm ACK 61bb4e783b3acc62b121a228f6b14c2462e23315 Tree-SHA512: c7497769d5745fa02c78a20f4a0e555d8d3996d64af6faf1ce28e22ac1d8be415b98e967294679007b7bda2a9fd04031a9d140b24201e00257ceadeb5c5d7665
2023-02-18lint: enable E722 do not use bare exceptLeonardo Lazzaro
2023-02-13Modernize rpcauth.py and its testsPieter Wuille
2023-01-18scripted-diff: Use new python 3.7 keywordsMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i 's/universal_newlines/text/g' $(git grep -l universal_newlines) -END VERIFY SCRIPT-
2022-04-27test, contrib, refactor: use `with` when opening a filebrunoerg
2022-02-21Replace "can not" with "cannot" in docs, user messages, and testsJon Atack
2022-01-26transaction decoding infer output descriptorsGregory Sanders
2021-12-29test: check that bitcoin-tx detects missing input amount for segwit transactionsSebastian Falbesoner
2021-10-12bitcoin-tx: Reject non-integral and out of range multisig numbersMarcoFalke
2021-10-12bitcoin-tx: Reject non-integral and out of range sequence idsMarcoFalke
2021-10-12test: Check that bitcoin-tx accepts whitespace around sequence id and ↵MarcoFalke
multisig numbers
2021-10-11bitcoin-tx: Avoid treating overflow as OP_0MarcoFalke
2021-09-02test: Rename bitcoin-util-test.py to util/test_runner.pyMarcoFalke
To normalize the name of all three test runners (fuzz, functional, util).
2021-08-16refactor: replace remaining binascii method calls Zero-1729
2021-06-18test: Add bitcoin-util testsMarcoFalke
2021-03-23rpc: deprecate `addresses` and `reqSigs` from rpc outputsMichael Dietz
1) add a new sane "address" field (for outputs that have an identifiable address, which doesn't include bare multisig) 2) with -deprecatedrpc: leave "reqSigs" and "addresses" intact (with all weird/wrong behavior they have now) 3) without -deprecatedrpc: drop "reqSigs" and "addresses" entirely, always.
2020-10-06refactor: Extract ParseOpCode from ParseScriptJoão Barbosa
A second lookup in mapOpNames is also removed.
2020-03-27Merge #18447: test: Add coverage for script parse error in ParseScriptMarcoFalke
dcda81c47101196e53e379d965a2692515ef8363 test: add coverage for script parse error in ParseScript (pierrenn) Pull request description: Follow up on this suggestion : https://github.com/bitcoin/bitcoin/pull/18416#issuecomment-603966799 This adds a test case to raise the `script parse error` in `ParseScript`. ACKs for top commit: instagibbs: utACK https://github.com/bitcoin/bitcoin/pull/18447/commits/dcda81c47101196e53e379d965a2692515ef8363 Tree-SHA512: ae0ef2c00f34cee818c83582f190d5f4043159e922862f2b442b7b895b8ff3ca421533699247c12c367be77813b5205830a771cd47a18e8932807ccace2d6a1c
2020-03-27Limit decimal range of numbers ParseScript acceptspierrenn
2020-03-27test: add coverage for script parse error in ParseScriptpierrenn
2019-08-30Don't show addresses or P2PK in decoderawtransactionnicolas.dorier
2018-12-13Remove Python 2 import workaroundspracticalswift
2018-11-17Properly generate salt in rpcauth.py, update testsCarl Dong
Previously, when iterating over bytes of the generated salt to construct a hex string, only one character would be outputted when the byte is less than 0x10. Meaning that for a 16 byte salt, the hex string might be less than 32 characters and collisions would occur.
2018-09-25Consolidate redundant implementations of ParseHashStrBen Woosley
This change: * adds a length check to ParseHashStr, appropriate given its use to populate a 256-bit number from a hex str. * allows the caller to handle the failure, which allows for the more appropriate JSONRPCError on failure in prioritisetransaction rpc
2018-08-13fix deprecation in bitcoin-util-test.pyIsidoro Ghezzi
To avoid: $ make check {…omissis…} Running test/util/bitcoin-util-test.py... /usr/local/bin/python3.7 ../test/util/bitcoin-util-test.py ../test/util/bitcoin-util-test.py:31: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead. config.readfp(open(os.path.join(os.path.dirname(__file__), "../config.ini"), encoding="utf8")) $ python3 --version Python 3.7.0
2018-08-09Always create 70 byte signatures with low R valuesAndrew Chow
When extra entropy is not specified by the caller, CKey::Sign will now always create a signature that has a low R value and is at most 70 bytes. The resulting signature on the stack will be 71 bytes when the sighash byte is included. Using low R signatures means that the resulting DER encoded signature will never need to have additional padding to account for high R values.
2018-07-07bitcoin-tx: Stricter check for valid integersDaniel Kraft
Just calling atoi to convert strings to integers does not check for valid integers very thoroughly; in particular, it just ignores everything starting from the first non-numeral character. Even a string like "foo" is fine and silently returns 0. This meant that bitcoin-tx would not fail if such a string was passed in various places where an integer is expected (like the locktime or an input/output index); this means that it would, for instance, silently accept a typo and interpret it in an unexpected way. In this change, we use ParseInt64 for parsing strings to integers, which actually verifies that the full string is valid as number. New tests in the bitcoin-util-test cover the new error paths.
2018-06-12Explicitly specify encoding when opening text files in Python codepracticalswift
2018-05-02rpcauth: Make it possible to provide a custom passwordWladimir J. van der Laan
This adds the functionality to specify a custom password to `rpcauth.py`, as well as makes the code (IMO) easier to understand.
2018-04-24[tests] Make rpcauth.py testable and add unit testsQasim Javed
refs #12995
2018-04-13Expose a transaction's weight via RPCMatt Corallo
2018-03-21Fix typospracticalswift
2018-01-24qa: Prepare functional tests for WindowsMarcoFalke
* Pass `sys.executable` when calling a python script via the subprocess module * Don't remove the log file while it is still open and written to * Properly use os.pathsep and os.path.sep when modifying the PATH environment variable * util-tests: Use os.path.join for Windows compatibility
2017-12-09Fix string concatenation to os.path.join and add exception casedongsamb
2017-10-11Merge #11420: Bump univalue subtree and fix json formatting in testsWladimir J. van der Laan
619bb05 Squashed 'src/univalue/' changes from 16a1f7f6e..fe805ea74 (MarcoFalke) Pull request description: The subtree-merge commit also fixes the whitespace for failing tests, such that bisect doesn't break. Finally, the bump also includes the changes that accidentally modified our subtree, such that the subtree check should work fine now: ```sh ./contrib/devtools/git-subtree-check.sh src/univalue Tree-SHA512: 3009d1e52b6f41ef89ecc8a000649f08e44395538703f294995a6e913e3fbfb7813d6bd31fdb4acb6127fd4af99c095bf980a12f1f026bb27cacc66e1487cd1e
2017-10-03Merge #11433: qa: Restore bitcoin-util-test py2 compatibilityMarcoFalke
fafff1220 qa: Restore bitcoin-util-test py2 compatibility (MarcoFalke) Pull request description: Currently `./configure && make check` will look for python3, then python2. As long as we support python2 (and use it as fallback), `make check` should run fine with both python2 and python3. Fixes #11352 by @Zenitur Tree-SHA512: a335ebdd224328d6f924fe52a9b97de196926476c9ee04ce3280743ea93bcae355eb2d5d4bed4050c01b2e904105595eac7db2eaa9307207581caa0a98ebcc0b
2017-10-01qa: Restore bitcoin-util-test py2 compatibilityMarcoFalke
2017-09-29Bump univalue and fix json formatting in testsMarcoFalke
This merge commit bumps the univalue subtree and also updates the whitespace for some failing tests.
2017-09-29Merge #11167: Full BIP173 (Bech32) supportWladimir J. van der Laan
8213838 [Qt] tolerate BIP173/bech32 addresses during input validation (Jonas Schnelli) 06eaca6 [RPC] Wallet: test importing of native witness scripts (NicolasDorier) fd0041a Use BIP173 addresses in segwit.py test (Pieter Wuille) e278f12 Support BIP173 in addwitnessaddress (Pieter Wuille) c091b99 Implement BIP173 addresses and tests (Pieter Wuille) bd355b8 Add regtest testing to base58_tests (Pieter Wuille) 6565c55 Convert base58_tests from type/payload to scriptPubKey comparison (Pieter Wuille) 8fd2267 Import Bech32 C++ reference code & tests (Pieter Wuille) 1e46ebd Implement {Encode,Decode}Destination without CBitcoinAddress (Pieter Wuille) Pull request description: Builds on top of #11117. This adds support for: * Creating BIP173 addresses for testing (through `addwitnessaddress`, though by default it still produces P2SH versions) * Sending to BIP173 addresses (including non-v0 ones) * Analysing BIP173 addresses (through `validateaddress`) It includes a reformatted version of the [C++ Bech32 reference code](https://github.com/sipa/bech32/tree/master/ref/c%2B%2B) and an independent implementation of the address encoding/decoding logic (integrated with CTxDestination). All BIP173 test vectors are included. Not included (and intended for other PRs): * Full wallet support for SegWit (which would include automatically adding witness scripts to the wallet during automatic keypool topup, SegWit change outputs, ...) [see #11403] * Splitting base58.cpp and tests/base58_tests.cpp up into base58-specific code, and "address encoding"-code [see #11372] * Error locating in UI for BIP173 addresses. Tree-SHA512: 238031185fd07f3ac873c586043970cc2db91bf7735c3c168cb33a3db39a7bda81d4891b649685bb17ef90dc63af0328e7705d8cd3e8dafd6c4d3c08fb230341
2017-09-28Implement BIP173 addresses and testsPieter Wuille
2017-09-20Disallow uncompressed pubkeys in bitcoin-tx [multisig] output addsMatt Corallo
2017-08-07rpc: Use ValueFromAmount instead of FormatMoney in TxToUnivWladimir J. van der Laan
With this, the amounts returned in `decoderawtransaction` will be padded to 8 digits like anywhwere else in the API.
2017-06-06Merge bctest.py into bitcoin-util-test.pyJohn Newbery
bctest.py is only used as an import by bitcoin-util-test.py. There's no value in keeping it as a separate module, so let's merge them into a single module to keep building and packaging simpler. bitcoin-test-util is importable as a module, so if any future modules really want to import the code from bctest.py, they can import bitcoin-test-util and call the bctest functions by name.
2017-05-03Use shared config file for functional and util testsJohn Newbery
The functional tests and util tests both require a config file that is generated by ./configure. This commit merges those two config files into a single configuration file that can be shared by both tests. The config from config.ini is put into a Namespace object to maintain the interface with bctest.py. A future commit could change this interface to use a dictionary instead of a namespace.
2017-05-03Use an .ini config file for environment vars in bitcoin-util-test.pyJohn Newbery
2017-05-03Change help_text in bitcoin-util-test.py to a docstring.John Newbery
2017-05-03Change bitcoin-util-test.py to use Python3John Newbery
2017-04-28refactor TxToJSON() and ScriptPubKeyToJSON()jonnynewbs