-
Notifications
You must be signed in to change notification settings - Fork 38.8k
test: use MiniWallet for feature_dbcrash.py #25087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: use MiniWallet for feature_dbcrash.py #25087
Conversation
d5ff902 to
aa9fab1
Compare
ayush933
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK aa9fab1.
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
test/functional/feature_dbcrash.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about setting this to 0 by default for MiniWallet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it seems confusing that this needs to be set at all. Why would a fee of 1000 sat be ever too high?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxfeerate=0 is set here only for performance reasons, to skip this part in the course of the sendrawtransaction RPC:
bitcoin/src/node/transaction.cpp
Lines 71 to 80 in 0de3694
| if (max_tx_fee > 0) { | |
| // First, call ATMP with test_accept and check the fee. If ATMP | |
| // fails here, return error immediately. | |
| const MempoolAcceptResult result = node.chainman->ProcessTransaction(tx, /*test_accept=*/ true); | |
| if (result.m_result_type != MempoolAcceptResult::ResultType::VALID) { | |
| return HandleATMPError(result.m_state, err_string); | |
| } else if (result.m_base_fees.value() > max_tx_fee) { | |
| return TransactionError::MAX_FEE_EXCEEDED; | |
| } | |
| } |
With the fee-check enabled, the iterations take about twice as long (~2mins instead of ~1min on my machine). Added a comment to clarify.
test/functional/feature_dbcrash.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about using the private member here. What about def get_utxos(self, *, mark_as_spent=True): return copy.copy(self._utxos) or so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, accessing private members should be avoided. Thanks, done.
This test can now be run even with the Bitcoin Core wallet disabled.
aa9fab1 to
1da5e45
Compare
|
Force-pushed with suggestions from MarcoFalke (#25087 (comment), #25087 (comment)) taken into account. |
|
Code review ACK 1da5e45 |
brunoerg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crACK 1da5e45
1da5e45 test: use MiniWallet for feature_dbcrash.py (Sebastian Falbesoner) Pull request description: This PR enables one more of the non-wallet functional tests (feature_dbcrash.py) to be run even with the Bitcoin Code wallet by using the MiniWallet instead, as proposed in bitcoin#20078. ACKs for top commit: laanwj: Code review ACK 1da5e45 brunoerg: crACK 1da5e45 Tree-SHA512: 75ee9a32fd1451254004797d695d18032bd0fcb66ebd88cf737e147e43812525f6e884ec05fcc4f76f566dc71174c8ed7347bcdce16567db6511746ae64cead0
…drawtransaction() fafaad9 test: Set maxfeerate=0 in MiniWallet sendrawtransaction() (MacroFake) Pull request description: It should be safe to set, because MiniWallet will only ever deal with test transactions, so loss-of-funds is not a reason to keep the feerate check. It is beneficial to set, as it makes tests less verbose to write. Also, it may speed up tests, as the fee-check can be skipped: bitcoin/bitcoin#25087 (comment) ACKs for top commit: michaelfolkson: ACK fafaad9 theStack: Code-review ACK fafaad9 Tree-SHA512: 94c5c163595207a295c7b21f0127d669a9307f6f8b1de5e043d43c52a6714076e2fdce65f2644308a2b90c679642c94f771dab1ff8bc5c0c8b1f5013324b3902
…saction() fafaad9 test: Set maxfeerate=0 in MiniWallet sendrawtransaction() (MacroFake) Pull request description: It should be safe to set, because MiniWallet will only ever deal with test transactions, so loss-of-funds is not a reason to keep the feerate check. It is beneficial to set, as it makes tests less verbose to write. Also, it may speed up tests, as the fee-check can be skipped: bitcoin#25087 (comment) ACKs for top commit: michaelfolkson: ACK fafaad9 theStack: Code-review ACK fafaad9 Tree-SHA512: 94c5c163595207a295c7b21f0127d669a9307f6f8b1de5e043d43c52a6714076e2fdce65f2644308a2b90c679642c94f771dab1ff8bc5c0c8b1f5013324b3902
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 (feature_dbcrash.py) to be run even with the Bitcoin Code wallet by using the MiniWallet instead, as proposed in #20078.