Skip to content

test: check_mempool_result negative feerate #29459

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

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

kevkevinpal
Copy link
Contributor

Adds test coverage in mempool_accept.py to check if a negative maxfeerate is input into check_mempool_result
Asserts "Amount out of range" error message and -3 error code

Motivated by this comment

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 21, 2024

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 maflcko, brunoerg, davidgumberg

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

Adds test in mempool_accept to check if a negative maxfeerate is inputed
into check_mempool_result, asserts "Amount out of range" error message
and -3 error code
@kevkevinpal kevkevinpal force-pushed the mempoolAcceptNegativeValues branch from 93e6247 to bf264e0 Compare February 21, 2024 16:08
@maflcko
Copy link
Member

maflcko commented Feb 21, 2024

lgtm ACK bf264e0

@brunoerg
Copy link
Contributor

nice, utACK bf264e0

@davidgumberg
Copy link
Contributor

Looks great, ACK bf264e0

If you need to rebase you could also add a check that the same error is thrown when maxfeerate exceeds MAX_MONEY:

inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }

CAmount AmountFromValue(const UniValue& value, int decimals)
{
    // [...]
    if (!MoneyRange(amount))
        throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range");
    // [...]
}

The same tests should probably be added for sendrawtransaction but that could be done in a follow up.

@glozow glozow merged commit 3d255df into bitcoin:master Mar 14, 2024
@glozow glozow removed their assignment Mar 14, 2024
@bitcoin bitcoin locked and limited conversation to collaborators Mar 14, 2025
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