Skip to content

Commit

Permalink
xmr: de-async overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Sep 13, 2018
1 parent 89ae3ba commit 176b427
Show file tree
Hide file tree
Showing 18 changed files with 271 additions and 275 deletions.
1 change: 0 additions & 1 deletion src/apps/monero/controller/iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ async def confirm_transaction(self, tsx_data, creds=None, ctx=None):
from trezor.ui.text import Text
from trezor import ui
from trezor import loop
from trezor import log
from trezor import workflow
from trezor.ui import BACKLIGHT_DIM, BACKLIGHT_NORMAL

Expand Down
16 changes: 8 additions & 8 deletions src/apps/monero/controller/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,33 @@ def compute_tx_key(spend_key_private, tx_prefix_hash, salt=None, rand_mult=None)
return tx_key, salt, rand_mult


async def parse_msg(bts, msg):
def parse_msg(bts, msg):
from apps.monero.xmr.serialize import xmrserialize
from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter

reader = MemoryReaderWriter(memoryview(bts))
ar = xmrserialize.Archive(reader, False)
return await ar.message(msg)
return ar.message(msg)


async def parse_vini(bts):
def parse_vini(bts):
from apps.monero.xmr.serialize_messages.tx_prefix import TxinToKey

return await parse_msg(bts, TxinToKey())
return parse_msg(bts, TxinToKey())


async def dump_msg(msg, preallocate=None, msg_type=None):
def dump_msg(msg, preallocate=None, msg_type=None):
from apps.monero.xmr.serialize import xmrserialize
from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter

writer = MemoryReaderWriter(preallocate=preallocate)
ar = xmrserialize.Archive(writer, True)
await ar.message(msg, msg_type=msg_type)
ar.message(msg, msg_type=msg_type)
return writer.get_buffer()


async def dump_msg_gc(msg, preallocate=None, msg_type=None, del_msg=False):
b = await dump_msg(msg, preallocate=preallocate, msg_type=msg_type)
def dump_msg_gc(msg, preallocate=None, msg_type=None, del_msg=False):
b = dump_msg(msg, preallocate=preallocate, msg_type=msg_type)
if del_msg:
del msg

Expand Down
4 changes: 1 addition & 3 deletions src/apps/monero/protocol/key_image_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ async def sync(self, ctx, tds):
chash = key_image.compute_hash(td)

self.hasher.update(chash)
ki, sig = await key_image.export_key_image(
self.creds, self.subaddresses, td
)
ki, sig = key_image.export_key_image(self.creds, self.subaddresses, td)

crypto.encodepoint_into(buff_mv[0:32], ki)
crypto.encodeint_into(buff_mv[32:64], sig[0][0])
Expand Down
Loading

0 comments on commit 176b427

Please sign in to comment.