mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 08:17:37 +00:00
python-rpc: add missing getblock RPC parameters
This commit is contained in:
parent
475481949a
commit
ddf7890730
2 changed files with 8 additions and 6 deletions
|
@ -66,7 +66,7 @@ class BlockchainTest():
|
||||||
|
|
||||||
# we should not see a block at height
|
# we should not see a block at height
|
||||||
ok = False
|
ok = False
|
||||||
try: daemon.getblock(height)
|
try: daemon.getblock(height = height)
|
||||||
except: ok = True
|
except: ok = True
|
||||||
assert ok
|
assert ok
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class BlockchainTest():
|
||||||
# get the blocks, check they have the right height
|
# get the blocks, check they have the right height
|
||||||
res_getblock = []
|
res_getblock = []
|
||||||
for n in range(blocks):
|
for n in range(blocks):
|
||||||
res_getblock.append(daemon.getblock(height + n))
|
res_getblock.append(daemon.getblock(height = height + n))
|
||||||
block_header = res_getblock[n].block_header
|
block_header = res_getblock[n].block_header
|
||||||
assert abs(block_header.timestamp - time.time()) < 10 # within 10 seconds
|
assert abs(block_header.timestamp - time.time()) < 10 # within 10 seconds
|
||||||
assert block_header.height == height + n
|
assert block_header.height == height + n
|
||||||
|
@ -103,7 +103,7 @@ class BlockchainTest():
|
||||||
|
|
||||||
# we should not see a block after that
|
# we should not see a block after that
|
||||||
ok = False
|
ok = False
|
||||||
try: daemon.getblock(height + blocks)
|
try: daemon.getblock(height = height + blocks)
|
||||||
except: ok = True
|
except: ok = True
|
||||||
assert ok
|
assert ok
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class BlockchainTest():
|
||||||
|
|
||||||
# we should not see the popped block anymore
|
# we should not see the popped block anymore
|
||||||
ok = False
|
ok = False
|
||||||
try: daemon.getblock(height + blocks - 1)
|
try: daemon.getblock(height = height + blocks - 1)
|
||||||
except: ok = True
|
except: ok = True
|
||||||
assert ok
|
assert ok
|
||||||
|
|
||||||
|
|
|
@ -67,11 +67,13 @@ class Daemon(object):
|
||||||
}
|
}
|
||||||
return self.rpc.send_json_rpc_request(submitblock)
|
return self.rpc.send_json_rpc_request(submitblock)
|
||||||
|
|
||||||
def getblock(self, height=0):
|
def getblock(self, hash = '', height = 0, fill_pow_hash = False):
|
||||||
getblock = {
|
getblock = {
|
||||||
'method': 'getblock',
|
'method': 'getblock',
|
||||||
'params': {
|
'params': {
|
||||||
'height': height
|
'hash': hash,
|
||||||
|
'height': height,
|
||||||
|
'fill_pow_hash': fill_pow_hash,
|
||||||
},
|
},
|
||||||
'jsonrpc': '2.0',
|
'jsonrpc': '2.0',
|
||||||
'id': '0'
|
'id': '0'
|
||||||
|
|
Loading…
Reference in a new issue