Skip to content

Commit

Permalink
xmr: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Sep 17, 2018
1 parent 447a862 commit b1d4ab1
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/apps/monero/protocol/tsx_sign_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ async def set_input(self, src_entr):
pseudo_out = None
pseudo_out_hmac = None
alpha_enc = None
spend_enc = None

if self.use_simple_rct:
alpha, pseudo_out = self._gen_commitment(src_entr.amount)
Expand Down Expand Up @@ -896,7 +895,7 @@ def _range_proof(self, idx, amount, rsig_data=None):
self.output_masks = []
return rsig, mask

def _set_out1_ecdh(self, idx, dest_pub_key, amount, mask, amount_key):
def _set_out1_ecdh(self, dest_pub_key, amount, mask, amount_key):
from apps.monero.xmr import ring_ct

# Mask sum
Expand Down Expand Up @@ -1046,7 +1045,6 @@ async def set_out1(self, dst_entr, dst_entr_hmac, rsig_data=None):

# Out_pk, ecdh_info
out_pk, ecdh_info_bin = self._set_out1_ecdh(
self.out_idx,
dest_pub_key=tx_out_key,
amount=dst_entr.amount,
mask=mask,
Expand Down Expand Up @@ -1331,7 +1329,6 @@ async def sign_input(
gc.collect()
from apps.monero.xmr import mlsag2

mg = None
if self.use_simple_rct:
# Simple RingCT
mix_ring = [x.key for x in src_entr.outputs]
Expand Down
2 changes: 1 addition & 1 deletion src/apps/monero/xmr/mlsag2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def scalar_gen_vector(n):
"""
Generates vector of scalars
"""
return [crypto.random_scalar() for i in range(0, n)]
return [crypto.random_scalar() for _ in range(0, n)]


#
Expand Down
1 change: 0 additions & 1 deletion src/apps/monero/xmr/monero.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def generate_tx_spend_and_key_image(

# step 2: add Hs(SubAddr || a || index_major || index_minor)
subaddr_sk = None
scalar_step2 = None
if received_index == (0, 0):
scalar_step2 = scalar_step1
else:
Expand Down
9 changes: 0 additions & 9 deletions src/apps/monero/xmr/ring_ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
from apps.monero.xmr import crypto


def bp_size(outputs):
M, logM = 1, 0
while M <= 16 and M < outputs:
logM += 1
M = 1 << logM

return 32 * (21 + outputs + 2 * logM)


def prove_range_bp(amount, last_mask=None):
mask = last_mask if last_mask is not None else crypto.random_scalar()
bp_proof = prove_range_bp_batch([amount], [mask])
Expand Down
2 changes: 1 addition & 1 deletion src/apps/monero/xmr/sub/recode.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def recode_ecdh(ecdh, encode=True):
def recode_msg(mgs, encode=True):
"""
Recodes MGs signatures from raw forms to bytearrays so it works with serialization
:param rv:
:param mgs:
:param encode: if true encodes to byte representation, otherwise decodes from byte representation
:return:
"""
Expand Down

0 comments on commit b1d4ab1

Please sign in to comment.