-
Notifications
You must be signed in to change notification settings - Fork 720
rpc: Backport getblock verbosity #2779
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
Changes from 1 commit
715f2a2
f4943e5
8488f7e
b512d94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ def run_test(self): | |
| self._test_getblockchaininfo() | ||
| self._test_gettxoutsetinfo() | ||
| self._test_getblockheader() | ||
| self._test_getblock() | ||
| #self._test_getdifficulty() | ||
| self.nodes[0].verifychain(0) | ||
|
|
||
|
|
@@ -108,5 +109,17 @@ def _test_getdifficulty(self): | |
| # binary => decimal => binary math is why we do this check | ||
| assert abs(difficulty * 2**31 - 1) < 0.0001 | ||
|
|
||
| def _test_getblock(self): | ||
| node = self.nodes[0] | ||
|
|
||
| # Test getblock verbosity | ||
| besthash = node.getbestblockhash() | ||
| assert(isinstance(node.getblock(blockhash=besthash, verbose=False), str)) | ||
| assert(isinstance(node.getblock(blockhash=besthash, verbosity=0), str)) | ||
| assert(isinstance(node.getblock(besthash, 1)['tx'][0], str)) | ||
| assert(isinstance(node.getblock(besthash, True)['tx'][0], str)) | ||
| assert('vin' in node.getblock(besthash, 2)['tx'][0]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! Would love to see some stricter tests then just checking if a string is returned |
||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| BlockchainTest().main() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,16 +30,6 @@ def run_test(self): | |
| assert_equal(node.echo(arg9=None), [None]*10) | ||
| assert_equal(node.echo(arg0=0,arg3=3,arg9=9), [0] + [None]*2 + [3] + [None]*5 + [9]) | ||
|
|
||
| # Test getblock verbosity | ||
| block = node.getblock(blockhash=h, verbosity=0) | ||
| assert(isinstance(block, str)) | ||
|
|
||
| block = node.getblock(blockhash=h, verbosity=1) | ||
| assert(isinstance(block['tx'][0], str)) | ||
|
|
||
| block = node.getblock(blockhash=h, verbosity=2) | ||
| assert('vin' in block['tx'][0]) | ||
|
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if __name__ == '__main__': | ||
| NamedArgumentTest().main() | ||
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.