Skip to content

Conversation

@theStack
Copy link
Contributor

@theStack theStack commented May 8, 2022

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.

@theStack theStack force-pushed the 202205-test-use_MiniWallet_for_feature_dbcrash branch from d5ff902 to aa9fab1 Compare May 8, 2022 22:58
@DrahtBot DrahtBot added the Tests label May 9, 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 aa9fab1.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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:

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.

Copy link
Member

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?

Copy link
Contributor Author

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.
@theStack theStack force-pushed the 202205-test-use_MiniWallet_for_feature_dbcrash branch from aa9fab1 to 1da5e45 Compare May 19, 2022 15:58
@theStack
Copy link
Contributor Author

Force-pushed with suggestions from MarcoFalke (#25087 (comment), #25087 (comment)) taken into account.

@laanwj
Copy link
Member

laanwj commented Jun 1, 2022

Code review ACK 1da5e45

Copy link
Contributor

@brunoerg brunoerg left a comment

Choose a reason for hiding this comment

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

crACK 1da5e45

@maflcko maflcko merged commit 9cc010f into bitcoin:master Jun 1, 2022
@theStack theStack deleted the 202205-test-use_MiniWallet_for_feature_dbcrash branch June 1, 2022 15:02
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 1, 2022
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
maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Jun 1, 2022
…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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 2, 2022
…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
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 Oct 11, 2022
@bitcoin bitcoin deleted a comment from joshuadbryant1985 Oct 11, 2022
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.

6 participants