1
0

integrate PSBT support natively. WIP

This commit is contained in:
SomberNight
2019-10-23 17:09:41 +02:00
parent 6d12ebabbb
commit bafe8a2fff
61 changed files with 3405 additions and 3310 deletions

View File

@@ -25,6 +25,7 @@
import base64
import hashlib
import functools
from typing import Union, Tuple, Optional
import ecdsa
@@ -181,6 +182,7 @@ class _PubkeyForPointAtInfinity:
point = ecdsa.ellipticcurve.INFINITY
@functools.total_ordering
class ECPubkey(object):
def __init__(self, b: Optional[bytes]):
@@ -257,6 +259,14 @@ class ECPubkey(object):
def __ne__(self, other):
return not (self == other)
def __hash__(self):
return hash(self._pubkey.point.x())
def __lt__(self, other):
if not isinstance(other, ECPubkey):
raise TypeError('comparison not defined for ECPubkey and {}'.format(type(other)))
return self._pubkey.point.x() < other._pubkey.point.x()
def verify_message_for_address(self, sig65: bytes, message: bytes, algo=lambda x: sha256d(msg_magic(x))) -> None:
assert_bytes(message)
h = algo(message)