mirror of
https://git.wownero.com/lza_menace/wownero-python.git
synced 2024-08-15 03:25:25 +00:00
Fix minor bugs in JSONRPC daemon backend and offline wallet, add tests
This commit is contained in:
parent
3478e24d33
commit
64149f6323
8 changed files with 173 additions and 7 deletions
|
@ -53,7 +53,8 @@ class JSONRPCDaemon(object):
|
|||
txs.append(Transaction(
|
||||
hash=tx['id_hash'],
|
||||
fee=from_atomic(tx['fee']),
|
||||
timestamp=datetime.fromtimestamp(tx['receive_time'])))
|
||||
timestamp=datetime.fromtimestamp(tx['receive_time']),
|
||||
confirmations=0))
|
||||
return txs
|
||||
|
||||
def raw_request(self, path, data):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from .. import exceptions
|
||||
from ..account import Account
|
||||
from ..address import Address
|
||||
from ..numbers import EMPTY_KEY
|
||||
from ..seed import Seed
|
||||
|
||||
|
||||
|
@ -14,7 +15,7 @@ class OfflineWallet(object):
|
|||
"""
|
||||
_address = None
|
||||
_svk = None
|
||||
_ssk = None
|
||||
_ssk = EMPTY_KEY
|
||||
|
||||
def __init__(self, address, view_key=None, spend_key=None):
|
||||
self._address = Address(address)
|
||||
|
@ -42,7 +43,7 @@ class OfflineWallet(object):
|
|||
def addresses(self, account=0):
|
||||
if account == 0:
|
||||
return [self._address]
|
||||
raise WalletIsOffline()
|
||||
raise WalletIsOffline() # pragma: no cover (this should never happen)
|
||||
|
||||
def new_address(self, account=0, label=None):
|
||||
raise WalletIsOffline()
|
||||
|
|
|
@ -2,6 +2,7 @@ from decimal import Decimal
|
|||
import sys
|
||||
|
||||
PICONERO = Decimal('0.000000000001')
|
||||
EMPTY_KEY = '0' * 64
|
||||
|
||||
if sys.version_info < (3,): # pragma: no cover
|
||||
_integer_types = (int, long,)
|
||||
|
|
|
@ -5,6 +5,7 @@ import struct
|
|||
from . import address
|
||||
from . import base58
|
||||
from . import ed25519
|
||||
from . import numbers
|
||||
from . import prio
|
||||
from .transaction import Payment, PaymentManager
|
||||
|
||||
|
@ -68,7 +69,7 @@ class Wallet(object):
|
|||
:rtype: str or None
|
||||
"""
|
||||
key = self._backend.spend_key()
|
||||
if key.strip('0') == '':
|
||||
if key == numbers.EMPTY_KEY:
|
||||
return None
|
||||
return key
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue