Compare commits

..

5 Commits

@ -14,7 +14,7 @@ before_install:
- rm -rf dist && python setup.py sdist # prep package distribution
install:
- pip install dist/*.tar.gz # install dependencies as specified in setup.py
- pip install -r test_requirements.txt
- pip install -r test_requirements_py`echo $TRAVIS_PYTHON_VERSION | cut -f 1 -d .`.txt
script:
- pytest
after_success:

@ -1 +1 @@
include *requirements.txt
include *requirements*.txt

@ -4,6 +4,7 @@ import operator
import re
import sha3
import six
import struct
import varint
import warnings
from ..address import address
@ -160,10 +161,8 @@ class Transaction(object):
local_address=addr)
amount_hs = sha3.keccak_256(b"amount" + Hs).digest()
xormask = amount_hs[:len(encamount)]
dec_amount = bytes(a ^ b for a, b in zip(encamount, xormask))
int_amount = int.from_bytes(
dec_amount, byteorder="little", signed=False
)
dec_amount = bytearray(a ^ b for a, b in zip(*map(bytearray, (encamount, xormask))))
int_amount = struct.unpack("<Q", dec_amount)[0]
amount = from_atomic(int_amount)
return Payment(
amount=amount,

@ -1,4 +1,5 @@
import binascii
import six
import varint
@ -34,7 +35,7 @@ class ExtraParser(object):
return extra
def _pop_pubkey(self, extra):
key = bytes(extra[:32])
key = bytes(bytearray(extra[:32])) # bytearray() is for py2 compatibility
if len(key) < 32:
raise ValueError(
"offset {:d}: only {:d} bytes of key data, expected 32".format(
@ -58,7 +59,7 @@ class ExtraParser(object):
elif extra[0] == self.TX_EXTRA_TAG_ADDITIONAL_PUBKEYS:
extra = extra[1:]
self.offset += 1
keycount = varint.decode_bytes(bytes(extra))
keycount = varint.decode_bytes(bytearray(extra))
valen = len(varint.encode(keycount))
extra = extra[valen:]
self.offset += valen
@ -76,7 +77,7 @@ class ExtraParser(object):
"offset {:d}: extra nonce exceeds field size".format(self.offset)
)
return []
nonce = bytes(extra[:noncelen])
nonce = bytearray(extra[:noncelen])
if "nonces" in self.data:
self.data["nonces"].append(nonce)
else:

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import codecs
import os
import re
import sys
from distutils.core import setup
from setuptools import find_packages
@ -33,7 +34,9 @@ setup(
url = 'https://github.com/monero-ecosystem/monero-python/',
long_description = open('README.rst', 'rb').read().decode('utf-8'),
install_requires = open('requirements.txt', 'r').read().splitlines(),
tests_require=open('test_requirements.txt', 'r').read().splitlines(),
tests_require=open(
'test_requirements_py{:d}.txt'.format(sys.version_info.major),
'r').read().splitlines(),
setup_requires=[
'pytest-runner',
],

@ -0,0 +1,7 @@
coverage~=5.3
coveralls~=1.11
pip>=9
pytest-cov~=2.10
pytest-runner~=5.2
pytest~=4.6
responses~=0.12
Loading…
Cancel
Save