Use correct daemon API
This commit is contained in:
parent
59b2b2cb04
commit
d8bb174f2b
@ -128,6 +128,10 @@ class Daemon(util.LoggedClass):
|
|||||||
params_iterable = ((h, ) for h in range(first, first + count))
|
params_iterable = ((h, ) for h in range(first, first + count))
|
||||||
return await self._send_vector('getblockhash', params_iterable)
|
return await self._send_vector('getblockhash', params_iterable)
|
||||||
|
|
||||||
|
async def deserialised_block(self, hex_hash):
|
||||||
|
'''Return the deserialised block with the given hex hash.'''
|
||||||
|
return await self._send_single('getblock', (hex_hash, True))
|
||||||
|
|
||||||
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, False) for h in hex_hashes)
|
||||||
|
|||||||
@ -382,8 +382,8 @@ class ElectrumX(JSONRPC):
|
|||||||
@classmethod
|
@classmethod
|
||||||
async def tx_merkle(cls, tx_hash, height):
|
async def tx_merkle(cls, tx_hash, height):
|
||||||
'''tx_hash is a hex string.'''
|
'''tx_hash is a hex string.'''
|
||||||
block_hash = await cls.DAEMON.send_single('getblockhash', (height,))
|
hex_hashes = await cls.DAEMON.block_hex_hashes(height, 1)
|
||||||
block = await cls.DAEMON.send_single('getblock', (block_hash, True))
|
block = await cls.DAEMON.deserialised_block(hex_hashes[0])
|
||||||
tx_hashes = block['tx']
|
tx_hashes = block['tx']
|
||||||
# This will throw if the tx_hash is bad
|
# This will throw if the tx_hash is bad
|
||||||
pos = tx_hashes.index(tx_hash)
|
pos = tx_hashes.index(tx_hash)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user