aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/wallet.py
AgeCommit message (Collapse)Author
2021-09-27test: MiniWallet: add `send_to` method to create arbitrary txoutsSebastian Falbesoner
With this new method, outputs to an arbitrary scriptPubKey/amount can be created. Note that the implementation was already present in the test feature_rbf.py and is just moved to the MiniWallet interface, in order to enable other tests to also use it.
2021-09-24Merge bitcoin/bitcoin#23047: test: Use MiniWallet in mempool_persistW. J. van der Laan
faae0988d6abb50039026a49543eef134eb9103f test: Check other fields are loaded correctly as well (MarcoFalke) fa4db9261725de8c0e5c73d13df1cddd6bbaeab0 test: Remove unused self.connect_nodes (MarcoFalke) fafb7b7a892b24405d6b6291d6d72f0e88462f2f test: pep8 (MarcoFalke) fa32cb2467056b3fd47f0b88215311faec8fd5a4 test: Use MiniWallet in mempool_persist (MarcoFalke) faca688a8579d7e30d056b6847789fdd56fc0bf4 test: Add MiniWallet get_descriptor function (MarcoFalke) Pull request description: ACKs for top commit: laanwj: Code review ACK faae0988d6abb50039026a49543eef134eb9103f Tree-SHA512: 6124f16ee1f3f416c50dc07aebe8846ff7e2b7c8e5dd84f9517cb5f1df021b9e57ed7c7e17bc099a37c663cd93f6d417c5e0622c0b359956403d53e705eb5549
2021-09-21Merge bitcoin/bitcoin#22998: test: use MiniWallet for make_utxo helper in ↵merge-script
feature_rbf.py f680d27155374de658d40db0ba40460919aa1ba2 test: use MiniWallet for make_utxo helper in feature_rbf.py (Sebastian Falbesoner) 0f275246027266fa256d0a09251bb2c88d9bd72f test: scale amounts in test_doublespend_tree down by factor 10 (Sebastian Falbesoner) d1e2481274edf2ac14747be633d86ecd46814ef4 test: scale amounts in test_doublespend_chain down by factor 10 (Sebastian Falbesoner) Pull request description: This PR aims to further increase MiniWallet usage in the functional test feature_rbf.py by using it in the `make_utxo(...)` helper, which is the only part that needs a wallet for most sub-tests. In order to do that, the amounts for the utxos have to be scaled down in two sub-tests first (`test_doublespend_chain` and `test_doublespend_tree`, see first two commits), since we need amounts passed to `make_utxo` than can be funded by only one input. For creating UTXOs with a value of 50 BTC, we'd need to implement a method for consolidating multiple utxos into one first, which seems to be overkill. Note that after this PR's change, there is only one sub-test left (`test_rpc`) that needs the wallet compiled into bitcoind. ACKs for top commit: MarcoFalke: review ACK f680d27155374de658d40db0ba40460919aa1ba2 🦐 Tree-SHA512: 46c8c245086a9e79855c4ede2f8f412333cf2658136805196b203b3567c89398d77fcb80715c0bb72fdc84331cc67544b2fdc259193a3adcb2fc36e147c26fce
2021-09-20test: Add MiniWallet get_descriptor functionMarcoFalke
2021-09-20test: Replace MiniWallet scan_blocks with rescan_utxosMarcoFalke
2021-09-16test: use MiniWallet for make_utxo helper in feature_rbf.pySebastian Falbesoner
2021-09-12test: Simplify p2p_blocksonly test with new miniwallet rescan_utxos methodMarcoFalke
2021-08-06[test] parameterizable fee for make_chain and create_child_with_parentsglozow
2021-08-06[test] helper function to increase transaction weightglozow
2021-08-06extract/rename helper functions from rpc_packages.pyglozow
MOVEONLY; no change in behavior. Rename because there is another helper funciton in chain_transaction in test_framework.util.py
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-06-21Merge bitcoin/bitcoin#22089: test: MiniWallet: fix fee calculation for P2PK ↵MarcoFalke
and check tx vsize d6d2ab984547be4a9f7ba859a2a4c9ac9bfbf206 test: MiniWallet: fix fee calculation for P2PK and check tx vsize (Sebastian Falbesoner) ce024b1c0ef2dcd307023aaaab40373c8bf17db1 test: MiniWallet: force P2PK signature to have fixed size (71 bytes) (Sebastian Falbesoner) Pull request description: This PR is a follow-up to #21945. It aims to both fix the fee calculation for P2PK mode transactions and enable its vsize check. Currently, the latter assumes a fixed tx length, which is fine for anyone-can-spend txs but doesn't apply to P2PK output spends due to varying DER signature size; the vsize check is therefore disabled for P2PK mode on master branch. Creating one million DER signatures with MiniWallet shows the following distribution of sizes (smart people with better math skills probably could deduce the ratios without trying, but hey): | DER signature size [bytes] | #occurences (ratio) | | ------------- | ------------- | | 71 | 498893 (49.89%) | | 70 | 497244 (49.72%) | | 69 | 3837 (0.38%) | | 68 | 22 (0.0022%) | Note that even smaller signatures are possible (for smaller R and S values with leading zero bytes), it's just that the probability decreases exponentially. Instead of choosing a large vsize check range and hoping that smaller signatures are never created (potentially leading to flaky tests), the proposed solution is ~~to limit the signature size to the two most common sizes 71 and 70 (>99.6% probability) and then accordingly only check for two vsize values; the value to be used for fee calculation is a decimal right between the two possible sizes (167.5 vbytes) and for the vsize check it's rounded down/up integer values are used.~~ to simply grind the signature to a fixed size of 71 bytes (49.89% probability, i.e. on average each call to `sign_tx()`, on average two ECC signing operations are needed). ~~The idea of grinding signatures to a fixed size (similar to https://github.com/bitcoin/bitcoin/pull/13666 which grinds to low-R values) would be counter-productive, as the signature creation in the test suite is quite expensive and this would significantly slow down tests that calculate hundreds of signatures (like e.g. feature_csv_activation.py).~~ For more about transaction sizes on different input/output types, see the following interesting article: https://medium.com/coinmonks/on-bitcoin-transaction-sizes-97e31bc9d816 ACKs for top commit: MarcoFalke: Concept ACK d6d2ab984547be4a9f7ba859a2a4c9ac9bfbf206 Tree-SHA512: 011c70ee0e4adf9ba12902e4b6c411db9ae96bdd8bc810bf1d67713367998e28ea328394503371fc1f5087a819547ddaea56c073b28db893ae1c0031d7927f32
2021-06-10test: Add txin.sequence option to MiniWalletMarcoFalke
2021-06-08test: MiniWallet: fix fee calculation for P2PK and check tx vsizeSebastian Falbesoner
2021-06-08test: MiniWallet: force P2PK signature to have fixed size (71 bytes)Sebastian Falbesoner
In order to enable exact fee calculation for transactions that spend P2PK outputs in the MiniWallet, we enforce the created signatures to have a fixed length (>49.89% probability) by default. With that it is easier to check the created transactions vsize and avoid flaky tests that would appear whenever the signatures R- or S-values are smaller (due to leading zero bytes). Note that to get the total scriptSig size one has to add another 2 bytes, as there is also the OP_PUSHx instruction on the front and the sighash type byte on the back, leading to a final scriptSig size of 73 bytes.
2021-06-03test: convert docs into type annotations in test_framework/wallet.pyfanquake
2021-05-31test: run mempool_reorg.py even with wallet disabledDarius Parvin
- run mempool_reorg.py even when the wallet is not compiled - add `locktime` argument to `create_self_transfer` and `send_self_transfer` - use more logs instead of comments
2021-05-24test: MiniWallet: introduce enum type for output modeSebastian Falbesoner
For the MiniWallet constructor, the two boolean parameters "raw_script" and "use_p2pk" are replaced by a single parameter of the newly introduced type MiniWalletMode (derived by enum.Enum), which can hold the following values: - ADDRESS_OP_TRUE - RAW_OP_TRUE - RAW_P2PK
2021-05-17test: MiniWallet: add P2PK supportSebastian Falbesoner
2021-05-10test: use MiniWallet for feature_csv_activation.pySebastian Falbesoner
This test can now be run even with the Bitcoin Core wallet disabled.
2021-04-29test: Run feature_cltv with MiniWalletMarcoFalke
2021-04-23test: Create MiniWallet.create_self_transferMarcoFalke
2021-04-22test: Add MiniWallet.sendrawtransactionMarcoFalke
Can be reviewed with --ignore-all-space --color-moved=dimmed-zebra
2021-03-23test: Remove wallet dependency of utxo set hash testFabian Jahr
2021-02-16test: Speed up rpc_blockchain.py by removing miniwallet.generate()MarcoFalke
2021-01-12rpc: Return wtxid from testmempoolacceptMarcoFalke
2021-01-08test: Replace getmempoolentry with testmempoolaccept in MiniWalletMarcoFalke
2020-11-16test: run mempool_spend_coinbase.py even with wallet disabledMichael Dietz
2020-09-09test: Run rpc_txoutproof.py even with wallet disabledMarcoFalke
2020-09-09test: MiniWallet: Default fee_rate in send_self_transfer, Pass in utxo_to_spendMarcoFalke
Adds two new features to MiniWallet: * The fee rate is irrelevant sometimes, so just set an arbitrary default * The utxo to spend needs to be selected manually sometimes
2020-09-09test: bugfix: Actually pick largest utxoMarcoFalke
2020-09-07test: Use MiniWalet in p2p_feefilterMarcoFalke