1
0

fix some CLI/RPC commands

This commit is contained in:
SomberNight
2018-09-27 18:01:25 +02:00
parent 3b9a55fab4
commit 6b8ad2d126
4 changed files with 54 additions and 12 deletions

View File

@@ -51,6 +51,7 @@ class Synchronizer(PrintError):
'''
def __init__(self, wallet):
self.wallet = wallet
self.network = wallet.network
self.asyncio_loop = wallet.network.asyncio_loop
self.requested_tx = {}
self.requested_histories = {}
@@ -86,7 +87,7 @@ class Synchronizer(PrintError):
# request address history
self.requested_histories[addr] = status
h = address_to_scripthash(addr)
result = await self.session.send_request("blockchain.scripthash.get_history", [h])
result = await self.network.get_history_for_scripthash(h)
self.print_error("receiving history", addr, len(result))
hashes = set(map(lambda item: item['tx_hash'], result))
hist = list(map(lambda item: (item['tx_hash'], item['height']), result))
@@ -125,7 +126,7 @@ class Synchronizer(PrintError):
await group.spawn(self._get_transaction, tx_hash)
async def _get_transaction(self, tx_hash):
result = await self.session.send_request('blockchain.transaction.get', [tx_hash])
result = await self.network.get_transaction(tx_hash)
tx = Transaction(result)
try:
tx.deserialize()