fix tests
This commit is contained in:
parent
9ca4e60b84
commit
9e1931587d
@ -60,7 +60,7 @@ class Test_bitcoin(unittest.TestCase):
|
|||||||
assert xprv == "xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j"
|
assert xprv == "xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j"
|
||||||
|
|
||||||
def _do_test_bip32(self, seed, sequence):
|
def _do_test_bip32(self, seed, sequence):
|
||||||
xprv, xpub = bip32_root(seed.decode('hex'))
|
xprv, xpub = bip32_root(seed.decode('hex'), 0)
|
||||||
assert sequence[0:2] == "m/"
|
assert sequence[0:2] == "m/"
|
||||||
path = 'm'
|
path = 'm'
|
||||||
sequence = sequence[2:]
|
sequence = sequence[2:]
|
||||||
|
|||||||
@ -55,6 +55,7 @@ class TestTransaction(unittest.TestCase):
|
|||||||
def test_tx_unsigned(self):
|
def test_tx_unsigned(self):
|
||||||
expected = {
|
expected = {
|
||||||
'inputs': [{
|
'inputs': [{
|
||||||
|
'type': 'p2pkh',
|
||||||
'address': '1446oU3z268EeFgfcwJv6X2VBXHfoYxfuD',
|
'address': '1446oU3z268EeFgfcwJv6X2VBXHfoYxfuD',
|
||||||
'is_coinbase': False,
|
'is_coinbase': False,
|
||||||
'num_sig': 1,
|
'num_sig': 1,
|
||||||
@ -102,6 +103,7 @@ class TestTransaction(unittest.TestCase):
|
|||||||
def test_tx_signed(self):
|
def test_tx_signed(self):
|
||||||
expected = {
|
expected = {
|
||||||
'inputs': [{
|
'inputs': [{
|
||||||
|
'type': 'p2pkh',
|
||||||
'address': '1446oU3z268EeFgfcwJv6X2VBXHfoYxfuD',
|
'address': '1446oU3z268EeFgfcwJv6X2VBXHfoYxfuD',
|
||||||
'is_coinbase': False,
|
'is_coinbase': False,
|
||||||
'num_sig': 1,
|
'num_sig': 1,
|
||||||
@ -143,7 +145,7 @@ class TestTransaction(unittest.TestCase):
|
|||||||
self.assertEquals(res, ('04ee98d63800824486a1cf5b4376f2f574d86e0a3009a6448105703453f3368e8e1d8d090aaecdd626a45cc49876709a3bbb6dc96a4311b3cac03e225df5f63dfc', '19h943e4diLc68GXW7G75QNe2KWuMu7BaJ'))
|
self.assertEquals(res, ('04ee98d63800824486a1cf5b4376f2f574d86e0a3009a6448105703453f3368e8e1d8d090aaecdd626a45cc49876709a3bbb6dc96a4311b3cac03e225df5f63dfc', '19h943e4diLc68GXW7G75QNe2KWuMu7BaJ'))
|
||||||
|
|
||||||
res = xpubkey_to_address('fd007d260305ef27224bbcf6cf5238d2b3638b5a78d5')
|
res = xpubkey_to_address('fd007d260305ef27224bbcf6cf5238d2b3638b5a78d5')
|
||||||
self.assertEquals(res, (None, '1CQj15y1N7LDHp7wTt28eoD1QhHgFgxECH'))
|
self.assertEquals(res, ('fd007d260305ef27224bbcf6cf5238d2b3638b5a78d5', '1CQj15y1N7LDHp7wTt28eoD1QhHgFgxECH'))
|
||||||
|
|
||||||
|
|
||||||
class NetworkMock(object):
|
class NetworkMock(object):
|
||||||
|
|||||||
@ -587,7 +587,7 @@ class Transaction:
|
|||||||
elif output_type == TYPE_ADDRESS:
|
elif output_type == TYPE_ADDRESS:
|
||||||
return get_scriptPubKey(addr)
|
return get_scriptPubKey(addr)
|
||||||
else:
|
else:
|
||||||
raise BaseException('Unknown output type')
|
raise TypeError('Unknown output type')
|
||||||
return script
|
return script
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user