forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: Merge bitcoin#20998, 20832, 21077, 20663, 20915 #5764
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0aab5fc
Merge #20998: test: Fix BlockToJsonVerbose benchmark
c893da4
Merge #20832: rpc: Better error messages for invalid addresses
meshcollider c652925
Merge #21077: doc: clarify -timeout and -peertimeout config options
c0f395b
Merge #20663: fuzz: Hide script_assets_test_minimizer
b1a2bb4
Merge #20915: fuzz: Fail if message type is not fuzzed
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) 2020 The Bitcoin Core developers | ||
| # Distributed under the MIT software license, see the accompanying | ||
| # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
| """Test error messages for 'getaddressinfo' and 'validateaddress' RPC commands.""" | ||
|
|
||
| from test_framework.test_framework import BitcoinTestFramework | ||
|
|
||
| from test_framework.util import ( | ||
| assert_equal, | ||
| assert_raises_rpc_error, | ||
| ) | ||
|
|
||
|
|
||
| BASE58_VALID = 'yjQ5gLvGRtmq1cwc4kePLCrzQ8GVCh9Gaz' | ||
| BASE58_INVALID_PREFIX = 'XpG61qAVhdyN7AqVZQsHfJL7AEk4dPVinc' | ||
|
|
||
| INVALID_ADDRESS = 'asfah14i8fajz0123f' | ||
|
|
||
| class InvalidAddressErrorMessageTest(BitcoinTestFramework): | ||
| def set_test_params(self): | ||
| self.setup_clean_chain = True | ||
| self.num_nodes = 1 | ||
|
|
||
| def skip_test_if_missing_module(self): | ||
| self.skip_if_no_wallet() | ||
|
|
||
| def test_validateaddress(self): | ||
| node = self.nodes[0] | ||
|
|
||
| # Base58 | ||
| info = node.validateaddress(BASE58_INVALID_PREFIX) | ||
| assert not info['isvalid'] | ||
| assert_equal(info['error'], 'Invalid prefix for Base58-encoded address') | ||
|
|
||
| info = node.validateaddress(BASE58_VALID) | ||
| assert info['isvalid'] | ||
| assert 'error' not in info | ||
|
|
||
| # Invalid address format | ||
UdjinM6 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| info = node.validateaddress(INVALID_ADDRESS) | ||
| assert not info['isvalid'] | ||
| assert_equal(info['error'], 'Invalid address format') | ||
|
|
||
UdjinM6 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| def test_getaddressinfo(self): | ||
| node = self.nodes[0] | ||
|
|
||
UdjinM6 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| assert_raises_rpc_error(-5, "Invalid prefix for Base58-encoded address", node.getaddressinfo, BASE58_INVALID_PREFIX) | ||
| assert_raises_rpc_error(-5, "Invalid address format", node.getaddressinfo, INVALID_ADDRESS) | ||
|
|
||
UdjinM6 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| def run_test(self): | ||
| self.test_validateaddress() | ||
| self.test_getaddressinfo() | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| InvalidAddressErrorMessageTest().main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.