Compare commits

...

5 Commits

@ -14,7 +14,7 @@ before_install:
- rm -rf dist && python setup.py sdist # prep package distribution - rm -rf dist && python setup.py sdist # prep package distribution
install: install:
- pip install dist/*.tar.gz # install dependencies as specified in setup.py - 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: script:
- pytest - pytest
after_success: after_success:

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

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

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

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import codecs import codecs
import os import os
import re import re
import sys
from distutils.core import setup from distutils.core import setup
from setuptools import find_packages from setuptools import find_packages
@ -33,7 +34,9 @@ setup(
url = 'https://github.com/monero-ecosystem/monero-python/', url = 'https://github.com/monero-ecosystem/monero-python/',
long_description = open('README.rst', 'rb').read().decode('utf-8'), long_description = open('README.rst', 'rb').read().decode('utf-8'),
install_requires = open('requirements.txt', 'r').read().splitlines(), 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=[ setup_requires=[
'pytest-runner', '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