Skip to content
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

wallet, mempool: propagete checkChainLimits error message to wallet #28863

Conversation

ismaelsadeeq
Copy link
Member

@ismaelsadeeq ismaelsadeeq commented Nov 13, 2023

  • Requested in #28391 comment

  • The error message is static when a new transaction is created and package limit is reached.
    Transaction has too long of a mempool chain
    While the CTxMempool::CheckPackageLimits provide explicit information about the error message.

  • This PR updates CTxMempool::CheckPackageLimits return type to util::Result<void>, CheckPackageLimits now returns void when package limit is not hit, and returns the error string whenever package limit is hit instead of using out parameter errString.

  • The PR updates checkChainLimits return type to util::Result<void>.

  • Now the wallet CreateTransactionInternal will have access to the package limit error string whenever its hit.

  • Also Updated functional test to reflect the error message from CTxMempool::CheckPackageLimits output.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 13, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK Sjors, TheCharlatan, glozow
Stale ACK BrandonOdiwuor

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #29086 (refactor: Simply include CTxMemPool::Options in CTxMemPool directly rather than duplicating definition by luke-jr)
  • #28676 ([WIP] Cluster mempool implementation by sdaftuar)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

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

Concept ACK.

It would be nice if the test can reach all four possible limit error messages, but if that's difficult to achieve it could wait for a followup.

test/functional/wallet_basic.py Outdated Show resolved Hide resolved
@ismaelsadeeq ismaelsadeeq force-pushed the 11-2023-prograte-checkPackageLimit-error-up branch from 2b4e86f to bd5417e Compare November 14, 2023 16:47
@ismaelsadeeq
Copy link
Member Author

ismaelsadeeq commented Nov 14, 2023

It would be nice if the test can reach all four possible limit error messages, but if that's difficult to achieve it could wait for a followup.

Previously we always got the Transaction has too long of a mempool chain message but with this PR we now get the node unconfirmed parents limit.
checkChainLimits is sending a package with one Internally created transaction and its vsize as the package vsize, package count will always be one.

Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor left a comment

Choose a reason for hiding this comment

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

Concept ACK

using the error message from checkChainLimits(...)

Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor left a comment

Choose a reason for hiding this comment

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

The PR looks good, left a Nit comment

src/node/interfaces.cpp Outdated Show resolved Hide resolved
@Sjors
Copy link
Member

Sjors commented Nov 17, 2023

Note that with cluster mempool #28676 the error would change. Which is another reason why I think it's useful to have tests cases for all four scenario's. But it can wait for another PR, and perhaps @sdaftuar could write it :-)

@ismaelsadeeq
Copy link
Member Author

Thanks @Sjors
I Would also like to work on it whenever that happens.

Copy link
Contributor

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

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

ACK bd5417e

src/interfaces/chain.h Outdated Show resolved Hide resolved
@DrahtBot DrahtBot requested review from BrandonOdiwuor and removed request for BrandonOdiwuor November 23, 2023 22:17
@ismaelsadeeq ismaelsadeeq force-pushed the 11-2023-prograte-checkPackageLimit-error-up branch from bd5417e to 28115d8 Compare November 24, 2023 19:09
@ismaelsadeeq
Copy link
Member Author

Thanks for review @TheCharlatan @furszy

Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor left a comment

Choose a reason for hiding this comment

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

ACK 28115d8

@ismaelsadeeq ismaelsadeeq force-pushed the 11-2023-prograte-checkPackageLimit-error-up branch from 28115d8 to e572a53 Compare November 24, 2023 22:00
@ismaelsadeeq ismaelsadeeq changed the title wallet: propagete checkChainLimits error message to wallet wallet, mempool: propagete checkChainLimits error message to wallet Nov 24, 2023
@ismaelsadeeq
Copy link
Member Author

Force pushed from 28115d8 to e572a53
Compare diff

return util::Error{_("Transaction has too long of a mempool chain")};
auto result = wallet.chain().checkChainLimits(tx);
if (!result) {
return util::Error{util::ErrorString(result)};
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a comment: Would be nice to get #25665 merged, so we can get a move constructor here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @TheCharlatan that can come as a follow-up post #25665 I think?

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, or it could even be done as part of that PR. It depends on which one gets merged first.

Update CheckPackageLimits to use util::Result to pass the error message
instead of out parameter.

Also update test to reflect the error message from `CTxMempool`
`CheckPackageLimits` output.
Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

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

utACK 8dec9c5

@@ -605,11 +605,9 @@ class CTxMemPool
* to mempool. The transactions need not be direct
* ancestors/descendants of each other.
* @param[in] total_vsize Sum of virtual sizes for all transactions in package.
* @param[out] errString Populated with error reason if a limit is hit.
Copy link
Member

Choose a reason for hiding this comment

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

* @returns {} or the error reason if a limit is hit.

Copy link
Member

Choose a reason for hiding this comment

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

this would be good

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Would create a tiny follow-up to fix this, so as not to invalidate ACK's.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is fixed in #29115

@DrahtBot DrahtBot requested review from BrandonOdiwuor and TheCharlatan and removed request for BrandonOdiwuor December 18, 2023 09:49
@Sjors
Copy link
Member

Sjors commented Dec 18, 2023

cc @glozow & @instagibbs

@DrahtBot DrahtBot requested review from BrandonOdiwuor and removed request for BrandonOdiwuor December 18, 2023 09:49
Copy link
Contributor

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

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

Re-ACK 8dec9c5

@DrahtBot DrahtBot requested review from BrandonOdiwuor and removed request for BrandonOdiwuor December 18, 2023 09:54
@glozow
Copy link
Member

glozow commented Dec 18, 2023

utACK 8dec9c5

@DrahtBot DrahtBot requested review from BrandonOdiwuor and removed request for BrandonOdiwuor December 18, 2023 10:27
Copy link
Member

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -605,11 +605,9 @@ class CTxMemPool
* to mempool. The transactions need not be direct
* ancestors/descendants of each other.
* @param[in] total_vsize Sum of virtual sizes for all transactions in package.
* @param[out] errString Populated with error reason if a limit is hit.
Copy link
Member

Choose a reason for hiding this comment

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

this would be good

@DrahtBot DrahtBot requested review from BrandonOdiwuor and removed request for BrandonOdiwuor December 18, 2023 14:27
@glozow glozow merged commit dd39194 into bitcoin:master Dec 18, 2023
16 checks passed
@glozow glozow removed their assignment Dec 18, 2023
glozow added a commit that referenced this pull request Dec 20, 2023
…eLimits` returns

19bb65b [doc]: add doxygen return comment for CheckPackageLimits (ismaelsadeeq)

Pull request description:

  This PR adds a  doxygen comment on `CheckPackageLimits` describing what the method returns.

  Fixes #28863 (comment)

ACKs for top commit:
  Sjors:
    utACK 19bb65b
  Zero-1729:
    utACK 19bb65b

Tree-SHA512: ccf1cc00a44d3fff60f28ad6766019a9f61b349729eab3cb02bc76b13c2e55441348a1602d806e60e4b2eabeb1f5d1ddacddf86c0bcdb78b078bb3a863b650c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants