test: use MiniWallet for mempool_package_onemore.py#24637
Conversation
maflcko
left a comment
There was a problem hiding this comment.
Concept ACK. Some questions/thoughts.
87f28c1 to
913a09c
Compare
There was a problem hiding this comment.
nit: Is this needed? The next line will assert even without this, but I can see the reason for a slightly better error message.
There was a problem hiding this comment.
nit: Maybe wrap all of this into a create_self_transfer_multi helper for symmetry with the existing helpers?
There was a problem hiding this comment.
nit: (Some renames for symmetry)
| def chain_tx(self, node, utxos, num_outputs=1, fee_per_output=1000): | |
| def send_self_transfer_multi(self, node_from, utxos, *, num_outputs=1, fee_per_output=1000): |
913a09c to
5d0c26a
Compare
|
Thanks again for the valuable feedback @MarcoFalke! Force-pushed with the following suggested changes:
The PR description was also adapted accordingly. |
There was a problem hiding this comment.
nit
| def create_self_transfer_multi(self, from_node, utxos, *, num_outputs=1, fee_per_output=1000): | |
| def create_self_transfer_multi(self, *, from_node, utxos, num_outputs=1, fee_per_output=1000): |
There was a problem hiding this comment.
nit:
| def send_self_transfer_multi(self, from_node, utxos, **kwargs): | |
| def send_self_transfer_multi(self, *, from_node, utxos, **kwargs): |
Also, "utxos" can be renamed to "inputs" or "utxos_to_spend".
There was a problem hiding this comment.
nit: Maybe return a dict similar to send_self_transfer?
| return [self.get_utxo(txid=txid, vout=vout) for vout in range(len(tx.vout))] | |
| return {"new_utxo":[self.get_utxo(txid=txid, vout=vout) for vout in range(len(tx.vout))], "tx": tx} |
There was a problem hiding this comment.
| def send_self_transfer_multi(self, from_node, utxos, **kwargs): | |
| def send_self_transfer_multi(self, **kwargs): |
or maybe even just
This test can now be run even with the Bitcoin Core wallet disabled.
5d0c26a to
2b6dd4e
Compare
|
Force-pushed again with the following changes:
|
maflcko
left a comment
There was a problem hiding this comment.
ACK 2b6dd4e 💾
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK 2b6dd4e75b3ad2daff553fde018fe4c8f1187878 💾
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUh0jgwAlqAJ870kGVFw8j59DsDnOgazr4Q3gZs3ev7+QPUDwABrwzfJggjUWYy8
G+fBs+4b/buewrlpMpLHMoAza3n1ib4yiR4Ayebbj65vyVhRVERBncLMlbnYDU7c
VQR0Fkuz5FTza9P7BuIegO3JPOXxPnJi5AKg8xSsIY7vZfNvXuwn74zyZqI14hCm
iDG4JtKtyiYpL+Mct9UWD9mKBUlEW1KnESejKVj5eQTG5ww0TijlNCfQ7W+JTE3m
ndwqmbuPI5RM7YqytsKuTpPc584nqr/zM1/AuIGM7aEM8BdwTW5StJCL6AuPL1B+
wD3w7HVltleskkvmj2407xPZkiGanxzOE7L3Q5G0GiWDCJFYU6jqXbRoJ8ml/oPn
b8kILOTtLvEqRNry8bOGiOAxTGZG8VkdsvRtjxBE/HLGtgX/avlN9ELPPvLE6GKD
rY+isoIqlqqGGZfLegweVnCuLJVS0+1o8HJAgwPyhyejVXbcU1EACstphCNdMtd8
s9QdQ3hV
=mjSo
-----END PGP SIGNATURE-----
| for i in range(num_outputs): | ||
| tx.vout[i].nValue = outputs_value_total // num_outputs |
There was a problem hiding this comment.
nit: Haven't tried, but this might be possible to write shorter
| for i in range(num_outputs): | |
| tx.vout[i].nValue = outputs_value_total // num_outputs | |
| for o in tx.vout: | |
| o.nValue = outputs_value_total // num_outputs |
494455f test: use MiniWallet for feature_fee_estimation.py (Sebastian Falbesoner) Pull request description: This PR enables one more of the non-wallet functional tests (feature_fee_estimation.py) to be run even with the Bitcoin Core wallet disabled by using the MiniWallet instead, as proposed in bitcoin#20078. It takes use of the recently introduced methods `{create,send}_self_transfer_multi` (bitcoin#24637) which allows to specify multiple UTXOs to be spent rather than only one. Very likely the test can still be simplified (e.g. coin selection in `small_txpuzzle_randfee`), but this is a first step. ACKs for top commit: ayush933: tACK 494455f . The test runs successfully with the wallet disabled. vincenzopalazzo: tACK bitcoin@494455f Tree-SHA512: 89789fc34a4374c79c4b90acd926ac69153aad655dab50450ed796f03c770bd675ad872e906f516f90e8d4cb40b83b55f3c78a94b13bfb8fe8f5e27624937748
494455f test: use MiniWallet for feature_fee_estimation.py (Sebastian Falbesoner) Pull request description: This PR enables one more of the non-wallet functional tests (feature_fee_estimation.py) to be run even with the Bitcoin Core wallet disabled by using the MiniWallet instead, as proposed in bitcoin#20078. It takes use of the recently introduced methods `{create,send}_self_transfer_multi` (bitcoin#24637) which allows to specify multiple UTXOs to be spent rather than only one. Very likely the test can still be simplified (e.g. coin selection in `small_txpuzzle_randfee`), but this is a first step. ACKs for top commit: ayush933: tACK 494455f . The test runs successfully with the wallet disabled. vincenzopalazzo: tACK bitcoin@494455f Tree-SHA512: 89789fc34a4374c79c4b90acd926ac69153aad655dab50450ed796f03c770bd675ad872e906f516f90e8d4cb40b83b55f3c78a94b13bfb8fe8f5e27624937748
Github-Pull: bitcoin#24637 Rebased-From: eb3c5c4
0b78110 test: Move tx creation to create_self_transfer_multi (kouloumos) Pull request description: Two birds with one stone: replacement of #26278 with simplification of the MiniWallet's transaction creation logic. Currently the MiniWallet creates simple txns (1 input, 1 output) with `create_self_transfer`. #24637 introduced `create_self_transfer_multi` **which uses** `create_self_transfer` to create a "transaction template" which then adjusts (copy and mutate inputs and outputs) in order to create more complex multi-input multi-output transactions. This can more easily lead to issues such as #26278 and is more of a maintenance burden. This PR simplifies the logic by going the other way around. Now `create_self_transfer` **uses** `create_self_transfer_multi`. The transaction creation logic has been moved to `create_self_transfer_multi` which is being called by `create_self_transfer` to construct the simple case of 1 input 1 output transaction. ACKs for top commit: MarcoFalke: ACK 0b78110 👒 Tree-SHA512: 147e577ed5444bee57865bd375b37c9b49d6539e9875c30c2667e70fcba27fe80bcb4552a4e6efb42760d34b40d5dad826883b778eaeefe29425ec081787b4bd
…ulti 0b78110 test: Move tx creation to create_self_transfer_multi (kouloumos) Pull request description: Two birds with one stone: replacement of bitcoin#26278 with simplification of the MiniWallet's transaction creation logic. Currently the MiniWallet creates simple txns (1 input, 1 output) with `create_self_transfer`. bitcoin#24637 introduced `create_self_transfer_multi` **which uses** `create_self_transfer` to create a "transaction template" which then adjusts (copy and mutate inputs and outputs) in order to create more complex multi-input multi-output transactions. This can more easily lead to issues such as bitcoin#26278 and is more of a maintenance burden. This PR simplifies the logic by going the other way around. Now `create_self_transfer` **uses** `create_self_transfer_multi`. The transaction creation logic has been moved to `create_self_transfer_multi` which is being called by `create_self_transfer` to construct the simple case of 1 input 1 output transaction. ACKs for top commit: MarcoFalke: ACK 0b78110 👒 Tree-SHA512: 147e577ed5444bee57865bd375b37c9b49d6539e9875c30c2667e70fcba27fe80bcb4552a4e6efb42760d34b40d5dad826883b778eaeefe29425ec081787b4bd
This PR enables one more of the non-wallet functional tests (mempool_package_onemore.py) to be run even with the Bitcoin Core wallet disabled by using the MiniWallet instead, as proposed in #20078. For this purpose helper methods
MiniWallet.{create,send}_self_transfer_multiare introduced which serve as a replacement forchain_transaction. With this, it should be also quite straight-forward to change the larger related testmempool_packages.pyto use MiniWallet.