Skip to content

Commit

Permalink
xmr: TxOut custom serialization optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Sep 13, 2018
1 parent ce0d9b0 commit c19ba12
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/apps/monero/protocol/tsx_sign_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,16 +1212,14 @@ 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 import xmrserialize
from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter

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

# Tx header prefix hashing
Expand Down

0 comments on commit c19ba12

Please sign in to comment.