Closes #3178 by adding verbosity level improvements to getblock RPC.
This is a follow-up commit for d0a1d833520d120bb5a2ac4cf4192047af6afe24 found in PR #3095 in order to fix nits and add a test.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
# Test merkleblock fetch/validation
|
||||
#
|
||||
|
||||
import string
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
from test_framework.util import assert_equal, assert_raises, \
|
||||
@@ -86,5 +87,13 @@ class MerkleBlockTest(BitcoinTestFramework):
|
||||
# ...or if we have a -txindex
|
||||
assert_equal(self.nodes[2].verifytxoutproof(self.nodes[3].gettxoutproof([txid_spent])), [txid_spent])
|
||||
|
||||
# Quick test of getblock using blockhash and different levels of verbosity
|
||||
result = self.nodes[0].getblock(blockhash, 2)
|
||||
coinbase_txid = result["tx"][0]["txid"]
|
||||
result = self.nodes[0].getblock(blockhash, 1)
|
||||
assert_equal(coinbase_txid, result["tx"][0]) # verbosity 1 only lists txids
|
||||
result = self.nodes[0].getblock(blockhash, 0)
|
||||
assert(c in string.hexdigits for c in result) # verbosity 0 returns raw hex
|
||||
|
||||
if __name__ == '__main__':
|
||||
MerkleBlockTest().main()
|
||||
|
||||
Reference in New Issue
Block a user