mirror of
https://git.wownero.com/lza_menace/wownero-python.git
synced 2024-08-15 03:25:25 +00:00
Merge branch 'master' into 0.5.x
This commit is contained in:
commit
6c1f667840
10 changed files with 136 additions and 74 deletions
|
@ -1,3 +1,3 @@
|
|||
from . import address, account, daemon, wallet, numbers, prio, wordlists, seed
|
||||
|
||||
__version__ = '0.4.3'
|
||||
__version__ = '0.4.4'
|
||||
|
|
|
@ -4,6 +4,7 @@ import struct
|
|||
from sha3 import keccak_256
|
||||
|
||||
from . import base58
|
||||
from . import ed25519
|
||||
from . import numbers
|
||||
|
||||
_ADDR_REGEX = re.compile(r'^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{95}$')
|
||||
|
@ -90,6 +91,20 @@ class Address(BaseAddress):
|
|||
"""
|
||||
return hexlify(self._decoded[1:33]).decode()
|
||||
|
||||
def check_private_view_key(self, key):
|
||||
"""Checks if private view key matches this address.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return ed25519.public_from_secret_hex(key) == self.view_key()
|
||||
|
||||
def check_private_spend_key(self, key):
|
||||
"""Checks if private spend key matches this address.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return ed25519.public_from_secret_hex(key) == self.spend_key()
|
||||
|
||||
def with_payment_id(self, payment_id=0):
|
||||
"""Integrates payment id into the address.
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
# Parts Copyright (c) 2016 The MoneroPy Developers. Released under the BSD 3-Clause
|
||||
|
||||
from binascii import hexlify, unhexlify
|
||||
import hashlib
|
||||
import operator as _oper
|
||||
import sys as _sys
|
||||
|
@ -133,3 +134,10 @@ def scalarmultbase(e):
|
|||
if e & 1: Q = edwards(Q, B)
|
||||
return Q
|
||||
|
||||
def public_from_secret(k):
|
||||
keyInt = decodeint(k)
|
||||
aG = scalarmultbase(keyInt)
|
||||
return encodepoint(aG)
|
||||
|
||||
def public_from_secret_hex(hk):
|
||||
return hexlify(public_from_secret(unhexlify(hk))).decode()
|
||||
|
|
|
@ -137,14 +137,10 @@ class Seed(object):
|
|||
return self.sc_reduce(h.digest())
|
||||
|
||||
def public_spend_key(self):
|
||||
keyInt = ed25519.decodeint(unhexlify(self.secret_spend_key()))
|
||||
aG = ed25519.scalarmultbase(keyInt)
|
||||
return hexlify(ed25519.encodepoint(aG)).decode()
|
||||
return ed25519.public_from_secret_hex(self.secret_spend_key())
|
||||
|
||||
def public_view_key(self):
|
||||
keyInt = ed25519.decodeint(unhexlify(self.secret_view_key()))
|
||||
aG = ed25519.scalarmultbase(keyInt)
|
||||
return hexlify(ed25519.encodepoint(aG)).decode()
|
||||
return ed25519.public_from_secret_hex(self.secret_view_key())
|
||||
|
||||
def public_address(self, net='mainnet'):
|
||||
"""Returns the master :class:`Address <monero.address.Address>` represented by the seed.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import sys
|
||||
import warnings
|
||||
from .address import address
|
||||
from .numbers import PaymentID
|
||||
|
||||
|
@ -160,7 +161,12 @@ class PaymentFilter(object):
|
|||
_payment_id = filterparams.pop('payment_id', None)
|
||||
if len(filterparams) > 0:
|
||||
raise ValueError("Excessive arguments for payment query: {}".format(filterparams))
|
||||
|
||||
if self.unconfirmed and (self.min_height is not None or self.max_height is not None):
|
||||
warnings.warn("Height filtering (min_height/max_height) has been requested while "
|
||||
"also asking for unconfirmed transactions. These are mutually exclusive. "
|
||||
"As mempool transactions have no height at all, they will be excluded "
|
||||
"from the result.",
|
||||
RuntimeWarning)
|
||||
if _local_address is None:
|
||||
self.local_addresses = []
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue