Skip to content

Commit

Permalink
xmr: tsx counter removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Sep 13, 2018
1 parent 76729be commit de7d718
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 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 @@ -470,12 +470,11 @@ async def _tprefix_update(self):
self.tx_prefix_hasher.release()
self._log_trace(10, True)

async def init_transaction(self, tsx_data, tsx_ctr):
async def init_transaction(self, tsx_data):
"""
Initializes a new transaction.
:param tsx_data:
:type tsx_data: TsxData
:param tsx_ctr:
:return:
"""
from apps.monero.xmr.sub.addr import classify_subaddresses
Expand Down Expand Up @@ -543,7 +542,7 @@ async def init_transaction(self, tsx_data, tsx_ctr):
self.tx.version = 2
self.tx.unlock_time = tsx_data.unlock_time
await self.process_payment_id(tsx_data)
await self.compute_sec_keys(tsx_data, tsx_ctr)
await self.compute_sec_keys(tsx_data)
gc.collect()

# Iterative tx_prefix_hash hash computation
Expand Down Expand Up @@ -618,19 +617,17 @@ async def process_payment_id(self, tsx_data):

self.tx.extra = tsx_helper.add_extra_nonce_to_tx_extra(b"", extra_nonce)

async def compute_sec_keys(self, tsx_data, tsx_ctr):
async def compute_sec_keys(self, tsx_data):
"""
Generate master key H(TsxData || r || c_tsx)
Generate master key H(TsxData || r)
:return:
"""
import protobuf
from apps.monero.xmr.sub.keccak_hasher import get_keccak_writer
from apps.monero.xmr.serialize import xmrserialize

writer = get_keccak_writer()
await protobuf.dump_message(writer, tsx_data)
await writer.awrite(crypto.encodeint(self.r))
await xmrserialize.dump_uvarint(writer, tsx_ctr)

self.key_master = crypto.keccak_2hash(
writer.get_digest() + crypto.encodeint(crypto.random_scalar())
Expand Down
2 changes: 1 addition & 1 deletion src/apps/monero/sign_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def sign_tx_dispatch(tsx, msg):


async def tsx_init(tsx, tsx_data):
return await tsx.init_transaction(tsx_data, 1) # TODO: remove counter
return await tsx.init_transaction(tsx_data)


async def tsx_set_input(tsx, msg):
Expand Down

0 comments on commit de7d718

Please sign in to comment.