aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_segwit.py
AgeCommit message (Collapse)Author
2022-11-10test: Remove wallet option from non-wallet testsMacroFake
Review note: The changes are complete, because self.options.descriptors is set to None in parse_args (test_framework.py). A value of None implies -disablewallet, see the previous commit. So if a call to add_wallet_options is missing, it will lead to a test failure when the wallet is compiled in.
2022-08-01test: negative/unknown `rpcserialversion` should throw an init errorbrunoerg
2022-03-18test: Fix generate calls and comments in feature_segwitMarcoFalke
2022-03-16test: Fix intermittent failure in feature_segwitDrahtBot
2022-02-23[miner] always assume we can create witness blocksglozow
Given the low possibility of a reorg reverting the segwit soft fork, there is no need to check whether segwit is active here. Also, TestBlockValidity is run on the block template after it has been created.
2021-11-10scripted-diff: Bump copyright headersMarcoFalke
The previous diff touched most files in ./test/, so bump the headers to avoid having to touch them again for a bump later. -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./test/ -END VERIFY SCRIPT-
2021-11-10scripted-diff: Remove redundant sync_all and sync_blocksMarcoFalke
The sync calls are redundant after a call to generate, because generate already syncs itself. -BEGIN VERIFY SCRIPT- perl -0777 -pi -e 's/(generate[^\n]*\)[^\n]*)(\n|\s)+self.sync_(all|blocks)\([^\)]*\)\n/\1\n/g' $(git grep -l generate ./test) -END VERIFY SCRIPT-
2021-10-26test: add script_util helper for creating bare multisig scriptsSebastian Falbesoner
2021-10-19tests: restrict feature_segwit legacy wallet import testsAndrew Chow
A portion of feature_segwit deals with the legacy wallet IsMine and import behavior. This is now hidden behind --legacy-wallet
2021-10-19tests: Use descriptors for feature_segwit multisig setupAndrew Chow
When setting up the multisig addresses in feature_segwit.py, use descriptors rather than addmultisigaddress.
2021-09-29test: introduce script_util helper for creating P2PK scriptsSebastian Falbesoner
2021-09-29Fix feature_segwit failure due to witnessSamuel Dobson
2021-09-28test: pep-8MarcoFalke
2021-09-28test: Use assert_equal over assert for easier debuggingMarcoFalke
2021-09-16Introduce -testactivationheight=name@height settingMarcoFalke
2021-09-02scripted-diff: Use generate* from TestFrameworkMarcoFalke
-BEGIN VERIFY SCRIPT- sed --regexp-extended -i \ 's/((self\.)?(nodes\[[^]]+\]|[a-z_]*(wallet|node)[0-9a-z_]*))\.(generate(|toaddress|block|todescriptor)(\(|, ))/self.\5\1, /g' \ $(git grep -l generate ./test | grep -v 'test_framework/' | grep -v 'feature_rbf') -END VERIFY SCRIPT-
2021-08-18test: use f-strings in feature_segwit.pyfanquake
2021-08-02Merge bitcoin/bitcoin#22378: test: remove confusing `MAX_BLOCK_BASE_SIZE`MarcoFalke
607076d01bf23c69ac21950c17b01fb4e1130774 test: remove confusing `MAX_BLOCK_BASE_SIZE` (Sebastian Falbesoner) 4af97c74edcda56cd15523bf3a335adea2bad14a test: introduce `get_weight()` helper for CBlock (Sebastian Falbesoner) a084ebe1330bcec15715e08b0f65319142927ad1 test: introduce `get_weight()` helper for CTransaction (Sebastian Falbesoner) Pull request description: This is a very late follow-up PR to #10618, which removed the constant `MAX_BLOCK_BASE_SIZE` from the core implementation about four years ago (see also #10608 in why it was considered confusing and superfluous). Since there is also no point in still keeping it in the functional test framework, the PR switches to weight-based accounting on the relevant test code parts and use `MAX_BLOCK_WEIGHT` instead for the block limit checks. To prepare that, the first two commits introduce `get_weight()` helpers for the classes CTransaction and CBlock, respectively. ACKs for top commit: MarcoFalke: review ACK 607076d01bf23c69ac21950c17b01fb4e1130774 🚴 Tree-SHA512: d59aa0b6b3dfd0a849b8063e66de275d252f705f99e25cd3bf6daec028b47d946777ee5b42a060f5283cb18e917ac073119c2c0e11bbc21211f69ef0a6ed335a
2021-08-01test: refactor: remove `hex_str_to_bytes` helperSebastian Falbesoner
Use the built-in class method bytes.fromhex() instead, which is available since Python 3.0.
2021-07-05test: use script_util helpers for creating P2W{PKH,SH} scriptsSebastian Falbesoner
2021-07-05test: use script_util helpers for creating P2SH scriptsSebastian Falbesoner
2021-07-01test: introduce `get_weight()` helper for CTransactionSebastian Falbesoner
2021-06-28test: use script_util helpers for creating P2PKH scriptsSebastian Falbesoner
2021-06-21test: remove `ToHex` helper, use .serialize().hex() insteadSebastian Falbesoner
2021-06-21test: introduce `tx_from_hex` helper for tx deserializationSebastian Falbesoner
`FromHex` is mostly used for transactions, so we introduce a shortcut `tx_from_hex` for `FromHex(CTransaction, hex_str)`.
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-20scripted-diff: test: Replace uses of (dis)?connect_nodes globalPrayank
-BEGIN VERIFY SCRIPT- # max-depth=0 excludes test/functional/test_framework/... FILES=$(git grep -l --max-depth 0 "connect_nodes" test/functional) # Replace (dis)?connect_nodes(self.nodes[a], b) with self.(dis)?connect_nodes(a, b) sed -i 's/\b\(dis\)\?connect_nodes(self\.nodes\[\(.*\)\]/self.\1connect_nodes(\2/g' $FILES # Remove imports in the middle of a line sed -i 's/\(dis\)\?connect_nodes, //g' $FILES sed -i 's/, \(dis\)\?connect_nodes//g' $FILES # Remove imports on a line by themselves sed -i '/^\s*\(dis\)\?connect_nodes,\?$/d' $FILES sed -i '/^from test_framework\.util import connect_nodes$/d' $FILES -END VERIFY SCRIPT- Co-authored-by: Elliott Jin <elliott.jin@gmail.com>
2020-10-16Merge #19401: QA: Use GBT to get block versions correctMarcoFalke
d438d609cd64fe532d94e45000495de93ef99aa6 QA: Use GBT to get block versions correct (Luke Dashjr) 1df2cd1c8f468bd7a5b1335a46ccea28fbddaacb QA: blocktools: Accept block template to create_block (Luke Dashjr) Pull request description: The goal here is to decouple unrelated tests from the details of block versions. Currently, these tests are forcing specific versions of blocks for no real reason. ACKs for top commit: fjahr: re-ACK d438d609cd64fe532d94e45000495de93ef99aa6 benthecarman: ACK d438d60 Tree-SHA512: 523b1cd4dac8d65c88432e126ce7f60df96ca4b94f7ecc8e83ba4ffbade23e2afe7055fdf586ce3c195a533f2004e63fff83add4267b39473a581c9f1c6d5340
2020-09-12QA: Use GBT to get block versions correctLuke Dashjr
2020-08-06refactor: test: use _ variable for unused loop countersSebastian Falbesoner
substitutes "for x in range(N):" by "for _ in range(N):" indicates to the reader that a block is just repeated N times, and that the loop counter is not used in the body
2020-06-22test: refactor functional tests to use restart_nodeChristopher Coverdale
2020-06-08Merge #18826: Expose txinwitness for coinbase in JSON form from RPCMarcoFalke
34645c4dd04f1e9bc199fb722de0bb397ec0e131 Test txinwitness is accessible on coinbase vin (Rod Vagg) 3e4421070af01374cd3daf77b28a2abc223c6f83 Expose txinwitness for coinbase in JSON form (Rod Vagg) Pull request description: ## Rationale The CLI can provide you with everything about transactions and blocks that you need to reconstruct the block structure and raw block itself **except** for the witness commitment nonce which is stored in the `scriptWitness` of the coinbase and is not printed. You could manually parse the raw `"hex"` fields for transactions if you really wanted to, but this seems to defeat the point of having a JSONification of the raw block/transaction data. Without the nonce you can't: 1. calculate and validate the witness commitment yourself, you can generate the witness tx merkle root but you don't have the nonce to combine it with 2. reconstruct the raw block form because you don't have `scriptWitness` stack associated with the coinbase (although you know how big it will be and can guess the common case of `[0x000...000]`) I'm building some archiving tooling for block data and being able to do a validated two-way conversion is very helpful. ## What This PR simply makes the `txinwitness` field not dependent on whether we are working with the coinbase or not. So you get it for the coinbase as well as the rest. ## Examples Common case of a `[0x000...000]` nonce: 00000000000000000000140a7289f3aada855dfd23b0bb13bb5502b0ca60cdd7 ```json "vin": [ { "coinbase": "0368890904c1fe8d5e2f706f6f6c696e2e636f6d2ffabe6d6d5565843a681160cf7b08b1b74ac90a719e6d6ab28c16d336b924f0dc2fcabdc6010000000000000051bf2ad74af345dbe642154b2658931612a70d195e007add0100ffffffff", "txinwitness": [ "0000000000000000000000000000000000000000000000000000000000000000" ], "sequence": 4294967295 } ], ... ``` Novel nonce value: 000000000000000000008c31945b2012258366cc600a3e9a3ee0598e8f797731 ```json "vin": [ { "coinbase": "031862082cfabe6d6d80c099b5e21f4c186d54eb292e17026932e52b1b807fa1380574c5adc1c843450200000000000000", "txinwitness": [ "5b5032506f6f6c5d5b5032506f6f6c5d5b5032506f6f6c5d5b5032506f6f6c5d" ], "sequence": 4294967295 } ], ... ``` ## Alternatives This field could be renamed for the coinbase, `"witnessnonce"` perhaps. It could also be omitted when null/zero (`0x000...000`). ## Tests This didn't break any tests and I couldn't find an obvious way to include a test for this. If this is desired I'd apreicate some pointers. ACKs for top commit: MarcoFalke: ACK 34645c4dd04f1e9bc199fb722de0bb397ec0e131 Tree-SHA512: b192facc1dfd210a5ec3f0d5d1ac6d0cae81eb35be15eaa71f60009a538dd6a79ab396f218434e7e998563f7f0df2c396cc925cb91619f6841c5a67806148c85
2020-05-19Merge #17946: Fix GBT: Restore "!segwit" and "csv" to "rules" keyMarcoFalke
412d5fe8791c417bf46fc55a5bb8d59be98a33db QA: feature_segwit: Check that template "rules" includes "!segwit" as appropriate (Luke Dashjr) 2abe8cc3b760219cfa434e4c96e9f8d3611d0037 Bugfix: Include "csv","!segwit" in "rules" (Luke Dashjr) Pull request description: #16060 removed CSV & segwit from versionbits, breaking the "rules" key returned by GBT. Without this, miners don't know they're mining segwit blocks, and should fall back to pre-segwit block creation. ACKs for top commit: sipa: ACK 412d5fe8791c417bf46fc55a5bb8d59be98a33db jnewbery: Tested ACK 412d5fe8791c417bf46fc55a5bb8d59be98a33db. Tree-SHA512: 825d72e257dc0dd4941f2fe498d8d4f4f2a21b9505cd21a8f9eb7fb5d6d7dd9219347928cf90bb57a777920ce24295859763e64fa8a22ebb58fc2380f80f5615
2020-05-08Test txinwitness is accessible on coinbase vinRod Vagg
2020-04-21Merge #18384: [test] more specific feature_segwit test error messages and ↵MarcoFalke
fixing incorrect comments 3c21db7b78fb0a27a0ea61b64eede8af0972791f [test] add 8 error messages to feature_segwit and change version to type (Gloria Zhao) Pull request description: Followup to [this](https://github.com/bitcoin/bitcoin/pull/15169/files#r303673472) comment on functional test feature_segwit.py verifying that unsigned witness transactions are invalid. (1) Changes 8 error messages from "mandatory-script-verify-flag" to "non-mandatory-script-verify-flag" and with more specific error messages. (2) Edits comments that incorrectly describe the test, namely that the `v` variable corresponds to using P2WSH versus P2WPKH, not witness versions. ACKs for top commit: MarcoFalke: ACK 3c21db7b78 🍾 Tree-SHA512: 3734ea3762667636c4fb20f5285634ab94d6b3527b7390fcc5e41b4582829dfe0099beabeaed42098613d168ede3385a6ffcd73989d1fa9dbd18004f5e9cf083
2020-04-21[test] add 8 error messages to feature_segwit and change version to typeGloria Zhao
P2WPKH witness program without signature -> throws "hash mismatch" error P2WSH witness program without signature -> throws "empty witness" error same errors for P2SH_P2WPKH and P2SH_P2WSH respectively when passed redeemScript but no signature P2SH_P2WPKH and P2SH_P2WSH with no signature fail with "Operation not valid with current stack size" when not signed due to missing input change VER to TYPE and constants WIT_V0 to P2WPKH=0 and WIT_V1 to P2WSH=1
2020-04-16scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-03-10ci: Enable all functional tests in valgrindMarcoFalke
2020-01-17QA: feature_segwit: Check that template "rules" includes "!segwit" as ↵Luke Dashjr
appropriate
2019-12-09test: re-enable CLI test support by using EncodeDecimal in json.dumps()fanquake
As mentioned in https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648
2019-12-06tests: Mark functional tests not supporting bitcoin-cli (--usecli) as suchpracticalswift
2019-10-10[logging] Don't log REJECT code when transaction is rejectedJohn Newbery
Remove the BIP61 REJECT code from error messages and logs when a transaction is rejected. BIP61 support was removed from Bitcoin Core in fa25f43ac5692082dba3f90456c501eb08f1b75c. The REJECT codes will be removed from the codebase entirely in the following commit.
2019-09-22test: use named args for sendrawtransaction callsJon Atack
involving more than one argument.
2019-09-18Merge #16521: rpc: Use the default maxfeerate value as BTC/kBWladimir J. van der Laan
2dfd6834ef8737e16e4b96df0c459f30a0721d6c test: Add test for default maxfeerate in sendrawtransaction (Joonmo Yang) 261843e4bef96ab296a9775819a99bfa60cad743 wallet/rpc: Use the default maxfeerate value as BTC/kB (Joonmo Yang) Pull request description: Fixes https://github.com/bitcoin/bitcoin/issues/16382 This patch tries to treat `maxfeerate` in sendrawtransaction/testmempoolaccept RPC as a rate(BTC/kB) instead of an absolute value(BTC). The included test case checks if the new behavior works correctly, by using the transaction with an absolute fee of ~0.02BTC, where the fee rate is ~0.2BTC/kB. This test should be failing if the default `maxfeerate` is 0.1BTC, but pass if the default value is 0.1BTC/kB ACKs for top commit: laanwj: ACK 2dfd6834ef8737e16e4b96df0c459f30a0721d6c (ACKs by Sjors and MarcoFalke above for trivially different code) Tree-SHA512: a1795bffe8a182acef8844797955db1f60bb0c0ded97148f3572dc265234d5219271a3a7aa0b6418a43f73b2b2720ef7412ba169c99bb1cdcac52051f537d6af
2019-08-19qa: Add RPC tests for weight in mempool entryDaniel Edgecumbe
2019-08-18wallet/rpc: Use the default maxfeerate value as BTC/kBJoonmo Yang
2019-08-14[Consensus] Bury segwit deploymentJohn Newbery
Hardcode segwit deployment height to 481824 for mainnet.
2019-06-21test: Require standard txs in regtestMarcoFalke
2019-04-09test: Remove unused importsMarcoFalke
2019-04-09scripted-diff: use self.sync_* methodsMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i -e 's/sync_blocks(self.nodes)/self.sync_blocks()/g' $(git grep -l 'sync_blocks(self.nodes)' ./test/functional/*.py) sed -i -e 's/sync_mempools(self.nodes)/self.sync_mempools()/g' $(git grep -l 'sync_mempools(self.nodes)' ./test/functional/*.py) sed -i -e 's/ sync_blocks(/ self.sync_blocks(/g' $(git grep -l sync_blocks ./test/functional/*.py) sed -i -e 's/ sync_mempools(/ self.sync_mempools(/g' $(git grep -l sync_mempools ./test/functional/*.py) -END VERIFY SCRIPT-