Skip to content

Conversation

@theStack
Copy link
Contributor

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_transactions is currently only used in this test, i.e. there was no need to change any others.

@fanquake fanquake added the Tests label Apr 12, 2022
Copy link
Contributor

@ayush933 ayush933 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 2f7f8fb

@theStack theStack force-pushed the 202204-test-use_MiniWallet_for_mining_prioritisetransaction branch from 2f7f8fb to b33bfe3 Compare April 13, 2022 22:43
This test can now be run even with the Bitcoin Core wallet disabled.
@theStack theStack force-pushed the 202204-test-use_MiniWallet_for_mining_prioritisetransaction branch from b33bfe3 to 9763c95 Compare April 16, 2022 19:27
@theStack theStack force-pushed the 202204-test-use_MiniWallet_for_mining_prioritisetransaction branch from 9763c95 to b167e53 Compare April 16, 2022 19:38
@theStack
Copy link
Contributor Author

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 create_lots_of_big_transactions to deduplicate code. This PR affects the functional tests

  • mining_prioritisetransaction.py (obviously)
  • mempool_limit.py (send_large_txs is replaced by create_lots_of_big_transactions)
  • feature_maxuploadtarget.py (calls mine_large_block where also create_lots_of_big_transactions is used to replace part of its function)

@fanquake
Copy link
Member

@ayush933 want to take another look?

Copy link
Contributor

@ayush933 ayush933 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK b167e53

Copy link
Member

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK b167e53

Copy link
Contributor

@kouloumos kouloumos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b167e53

# 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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: create_lots_of_big_transactions is not introduced in this PR, but maybe include "send" in the name, to clearly indicate functionality?

Copy link
Member

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b167e53

Comment on lines +559 to +560
use_internal_utxos = utxos is None
for _ in range(tx_batch_size):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nit:
if utxos is not empty, maybe assert that tx_batch_size >= len(utxos).

@maflcko maflcko merged commit 506d9b2 into bitcoin:master Jun 13, 2022
@theStack theStack deleted the 202204-test-use_MiniWallet_for_mining_prioritisetransaction branch June 13, 2022 16:02
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 13, 2022
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

maflcko pushed a commit that referenced this pull request Jun 15, 2022
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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 15, 2022
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
@bitcoin bitcoin locked and limited conversation to collaborators Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants