test: update some RPC arguments to int type

This commit is contained in:
Roy Lee 2021-11-08 16:03:19 -08:00 committed by Ubuntu
parent ffa1d00564
commit d200c847f0
2 changed files with 4 additions and 4 deletions

View file

@ -250,14 +250,14 @@ class Daemon:
async def deserialised_block(self, hex_hash): async def deserialised_block(self, hex_hash):
"""Return the deserialised block with the given hex hash.""" """Return the deserialised block with the given hex hash."""
if hex_hash not in self._block_cache: if hex_hash not in self._block_cache:
block = await self._send_single('getblock', (hex_hash, True)) block = await self._send_single('getblock', (hex_hash, 1))
self._block_cache[hex_hash] = block self._block_cache[hex_hash] = block
return block return block
return self._block_cache[hex_hash] return self._block_cache[hex_hash]
async def raw_blocks(self, hex_hashes): async def raw_blocks(self, hex_hashes):
"""Return the raw binary blocks with the given hex hashes.""" """Return the raw binary blocks with the given hex hashes."""
params_iterable = ((h, False) for h in hex_hashes) params_iterable = ((h, 0) for h in hex_hashes)
blocks = await self._send_vector('getblock', params_iterable) blocks = await self._send_vector('getblock', params_iterable)
# Convert hex string to bytes # Convert hex string to bytes
return [hex_to_bytes(block) for block in blocks] return [hex_to_bytes(block) for block in blocks]

View file

@ -1472,7 +1472,7 @@ class LBRYElectrumX(SessionBase):
if mempool_tx: if mempool_tx:
raw_tx, block_hash = mempool_tx.raw_tx.hex(), None raw_tx, block_hash = mempool_tx.raw_tx.hex(), None
else: else:
tx_info = await self.daemon_request('getrawtransaction', tx_hash, True) tx_info = await self.daemon_request('getrawtransaction', tx_hash, 1)
raw_tx = tx_info['hex'] raw_tx = tx_info['hex']
block_hash = tx_info.get('blockhash') block_hash = tx_info.get('blockhash')
if block_hash: if block_hash:
@ -1509,7 +1509,7 @@ class LBRYElectrumX(SessionBase):
if verbose not in (True, False): if verbose not in (True, False):
raise RPCError(BAD_REQUEST, f'"verbose" must be a boolean') raise RPCError(BAD_REQUEST, f'"verbose" must be a boolean')
return await self.daemon_request('getrawtransaction', tx_hash, verbose) return await self.daemon_request('getrawtransaction', tx_hash, int(verbose))
def _get_merkle_branch(self, tx_hashes, tx_pos): def _get_merkle_branch(self, tx_hashes, tx_pos):
"""Return a merkle branch to a transaction. """Return a merkle branch to a transaction.