Skip to content

Commit

Permalink
xmr: TxOut custom serialization optimized II
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Sep 13, 2018
1 parent c19ba12 commit 8d56c80
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/apps/monero/protocol/tsx_sign_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,14 +1212,11 @@ def _set_out1_derivation(self, dst_entr, additional_txkey_priv):
return derivation

async def _set_out1_tx_out(self, dst_entr, tx_out_key):
from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter

# Manual serialization of TxOut(0, TxoutToKey(key))
writer = MemoryReaderWriter(preallocate=34)
writer.write(b"\x00\x02") # amount, variant code TxoutToKey
writer.write(crypto.encodepoint(tx_out_key))
tx_out_bin = writer.get_buffer()
del(writer)
tx_out_bin = bytearray(34)
tx_out_bin[0] = 0 # amount varint
tx_out_bin[1] = 2 # variant code TxoutToKey
crypto.encodepoint_into(tx_out_bin, tx_out_key, 2)
self._mem_trace(8)

# Tx header prefix hashing
Expand Down

0 comments on commit 8d56c80

Please sign in to comment.