-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: Add multiple transactions and error handling tests for getreceivedbyaddress #34188
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
base: master
Are you sure you want to change the base?
Conversation
|
ACK 0d0b34d Built with wallet support and ran on macOS - all 4 test scenarios pass. Good coverage of minconf behavior, multiple transactions, error handling, and coinbase maturity. nit: Copyright header says 2017-2022 but this is a new file - might want to update to 2026-present or similar. |
Aah thank you I will update |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34188. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
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. |
|
How is this different from |
0d0b34d to
e7fb202
Compare
the test adds two important coverage areas that are missing in multiple transactions to the same address , which is a use case not covered in the existing test. The existing test only sends a single transaction (0.1 BTC) to an address. invalid address format error - tests error -5 "Invalid Bitcoin address" for malformed address strings. The existing test only covers error -4 "Address not found in wallet" this completes the error handling coverage. test file provides better organization and focuses specifically on |
|
My preference would be to keep related functionality checks for related RPCs in the same file, not create a separate file for each RPC. This will also avoid checking the same overlap several times redundantly. |
e7fb202 to
1538fc6
Compare
|
https://github.com/bitcoin/bitcoin/actions/runs/20658978454/job/59322217188?pr=34188#step:6:145: The subject line of commit hash 1538fc6d86d1d439646ab724ca7a721867213b14 is followed by a non-empty line. Subject lines should always be followed by a blank line. |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
1538fc6 to
9944a4c
Compare
9944a4c to
66bd4bf
Compare
rkrux
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.
Concept ACK 66bd4bf
https://maflcko.github.io/b-c-cov/total.coverage/src/wallet/rpc/coins.cpp.gcov.html
Although there isn't increased coverage due to the multiple transactions on same address test but logically it's good to have such a test. The invalid address test should increase the coverage.
66bd4bf to
0cbef7c
Compare
|
https://github.com/bitcoin/bitcoin/actions/runs/20722345957/job/59492260670?pr=34188#step:14:221: Traceback (most recent call last):
File "D:\a\bitcoin\bitcoin\build\test\functional\test_framework\test_framework.py", line 142, in main
self.run_test()
~~~~~~~~~~~~~^^
File "D:\a\bitcoin\bitcoin\build\test\functional\feature_bip68_sequence.py", line 66, in run_test
self.test_sequence_lock_confirmed_inputs()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\a\bitcoin\bitcoin\build\test\functional\feature_bip68_sequence.py", line 149, in test_sequence_lock_confirmed_inputs
num_inputs = random.randint(1, min(10, available_utxos))
File "C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\random.py", line 341, in randint
raise ValueError(f"empty range in randint({a}, {b})")
ValueError: empty range in randint(1, 0) |
0cbef7c to
bfb2642
Compare
the issue has been fixed in #34244. I rebased the PR. |
Just FYI, since this was an unrelated test failure in a file you are not touching, in the future you can either ask for someone to rerun the CI job for you or you can push a rebase proactively to retrigger the CI and see if the error really persists. |
|
But now there is a CI failure that seems related: |
bfb2642 to
fa45a3b
Compare
CI failed coz without self.sync_all() node 1 didn't have both transactions in its mempool when blocks were generated. |
fjahr
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.
utACK fa45a3b
Could make minor improvements to the sync but this looks ok for me as well.
- Add test for multiple transactions to same address - Add test for invalid address format error
fa45a3b to
dec4887
Compare
|
utACK dec4887 Just addressed my comment since last review. |
| addr_with_multiple_txs = self.nodes[1].getnewaddress() | ||
| self.nodes[0].sendtoaddress(addr_with_multiple_txs, Decimal("0.1")) | ||
| self.nodes[0].sendtoaddress(addr_with_multiple_txs, Decimal("0.2")) | ||
| self.generate(self.nodes[0], 10) |
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.
why generate 10 blocks, when 1 would be sufficient?
This PR adds comprehensive functional test coverage for the
getreceivedbyaddressRPC method.