Merge bitcoin/bitcoin#29459: test: check_mempool_result negative feerate

bf264e0598 test: check_mempool_result negative feerate (kevkevin)

Pull request description:

  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](https://github.com/bitcoin/bitcoin/pull/29434/files#r1491112250)

ACKs for top commit:
  maflcko:
    lgtm ACK bf264e0598
  brunoerg:
    nice, utACK bf264e0598
  davidgumberg:
    Looks great, ACK bf264e0598

Tree-SHA512: 58931b774cc887c616f2fd91af3ee65cc5db55acd8e2875c76de448c80bd4e020b057c5f4f85556431377f0d0e7553771fb285d1ec20cf64f64ec92a47776b78
This commit is contained in:
glozow 2024-03-14 11:14:56 +00:00
commit 3d255dfb67
No known key found for this signature in database
GPG Key ID: BA03F4DBE0C63FB4
1 changed files with 6 additions and 0 deletions

View File

@ -96,6 +96,12 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
rawtxs=[raw_tx_in_block],
maxfeerate=1,
))
# Check negative feerate
assert_raises_rpc_error(-3, "Amount out of range", lambda: self.check_mempool_result(
result_expected=None,
rawtxs=[raw_tx_in_block],
maxfeerate=-0.01,
))
# ... 0.99 passes
self.check_mempool_result(
result_expected=[{'txid': txid_in_block, 'allowed': False, 'reject-reason': 'txn-already-known'}],