test: use MiniWallet for mining_prioritisetransaction.py#24839
Conversation
2f7f8fb to
b33bfe3
Compare
This test can now be run even with the Bitcoin Core wallet disabled.
b33bfe3 to
9763c95
Compare
9763c95 to
b167e53
Compare
|
Force-pushed with suggestions from MarcoFalke taken into account. There is now a second commit which takes use of the brand-new shiny MiniWallet-variant of
|
|
@ayush933 want to take another look? |
| # transaction to make it large. See gen_return_txouts() above. | ||
| def create_lots_of_big_transactions(node, txouts, utxos, num, fee): | ||
| addr = node.getnewaddress() | ||
| def create_lots_of_big_transactions(mini_wallet, node, fee, tx_batch_size, txouts, utxos=None): |
There was a problem hiding this comment.
nit: create_lots_of_big_transactions is not introduced in this PR, but maybe include "send" in the name, to clearly indicate functionality?
| use_internal_utxos = utxos is None | ||
| for _ in range(tx_batch_size): |
There was a problem hiding this comment.
tiny nit:
if utxos is not empty, maybe assert that tx_batch_size >= len(utxos).
| utxos = create_confirmed_utxos(self, self.relayfee, self.nodes[0], utxo_count) | ||
| utxos = self.wallet.send_self_transfer_multi(from_node=self.nodes[0], num_outputs=utxo_count)['new_utxos'] | ||
| self.generate(self.wallet, 1) | ||
| assert_equal(len(self.nodes[0].getrawmempool()), 0) |
There was a problem hiding this comment.
I really wonder if it is worth it to move this to create_confirmed_utxos? Seems 2-3 LOC duplicated everywhere are fine compared to 1 LOC + import + definition in separate file?
Maybe just remove create_confirmed_utxos?
There was a problem hiding this comment.
Right, I agree that it's not worth it, calling send_self_transfer_multi with a subsequent generate is simple enough. Opened a follow-up PR: #25374
42b2fdf test: remove unused `create_confirmed_utxos` helper (Sebastian Falbesoner) Pull request description: After more and more non-wallet tests have been converted to use MiniWallet (#25087, #24839, #24749 etc.), the `create_confirmed_utxos` helper is now not used anymore and can be removed. An alternative would be to create a MiniWallet version of `create_confirmed_utxos`, but it seems that it's not worth it, considering that would be only two lines (calling MiniWallet's `send_self_transfer_multi` with a subsequent `generate` call), see comment #24839 (comment). ACKs for top commit: MarcoFalke: cr ACK 42b2fdf Tree-SHA512: 274418156265a6071940f53cbcd77f6779af5e951cfa1e5efbf07a5c61487b521ee19f36b4105e5c0a808139d121e5e262e77525ea3d1486a0421f01abcf58fd
42b2fdf test: remove unused `create_confirmed_utxos` helper (Sebastian Falbesoner) Pull request description: After more and more non-wallet tests have been converted to use MiniWallet (bitcoin#25087, bitcoin#24839, bitcoin#24749 etc.), the `create_confirmed_utxos` helper is now not used anymore and can be removed. An alternative would be to create a MiniWallet version of `create_confirmed_utxos`, but it seems that it's not worth it, considering that would be only two lines (calling MiniWallet's `send_self_transfer_multi` with a subsequent `generate` call), see comment bitcoin#24839 (comment). ACKs for top commit: MarcoFalke: cr ACK 42b2fdf Tree-SHA512: 274418156265a6071940f53cbcd77f6779af5e951cfa1e5efbf07a5c61487b521ee19f36b4105e5c0a808139d121e5e262e77525ea3d1486a0421f01abcf58fd
This PR enables one more of the non-wallet functional tests (mining_prioritisetransaction.py) to be run even with the Bitcoin Code wallet by using the MiniWallet instead, as proposed in #20078. Note that the adapted helper function
create_lots_of_big_transactionsis currently only used in this test, i.e. there was no need to change any others.