tests: o.address fix

pull/25/head
Tomas Susanka 7 years ago
parent d8a884bd87
commit 0e2bcd64e8

@ -116,7 +116,7 @@ async def check_tx_fee(tx: SignTx, root):
raise SigningError(FailureType.ActionCancelled,
'Total cancelled')
return h_first, tx_req, txo_bin, bip143, segwit, total_in, wallet_path
return h_first, bip143, segwit, total_in, wallet_path
async def sign_tx(tx: SignTx, root):
@ -125,8 +125,7 @@ async def sign_tx(tx: SignTx, root):
# Phase 1
h_first, tx_req, txo_bin, bip143, segwit, authorized_in, wallet_path = \
await check_tx_fee(tx, root)
h_first, bip143, segwit, authorized_in, wallet_path = await check_tx_fee(tx, root)
# Phase 2
# - sign inputs
@ -135,6 +134,11 @@ async def sign_tx(tx: SignTx, root):
coin = coins.by_name(tx.coin_name)
tx_ser = TxRequestSerializedType()
txo_bin = TxOutputBinType()
tx_req = TxRequest()
tx_req.details = TxRequestDetailsType()
tx_req.serialized = None
for i_sign in range(tx.inputs_count):
# hash of what we are signing with this input
h_sign = HashWriter(sha256)

@ -44,7 +44,7 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
address_n=None, # @todo ask honza about sanitizing
)
out2 = TxOutputType(
address='tb1q694ccp5qcc0udmfwgp692u2s2hjpq5h407urtu',
address='tb1q694ccp5qcc0udmfwgp692u2s2hjpq5h407urtu',
script_type=OutputScriptType.PAYTOADDRESS,
amount=12300000 - 11000 - 5000000,
address_n=None,
@ -170,7 +170,8 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
# returned serialized inp1
serialized_tx=unhexlify('010000000001018a44999c07bba32df1cacdc50987944e68e3205b4429438fdde35c76024614090000000000ffffffff'),
)),
TxAck(tx=TransactionType(outputs=[out1])),
# the out has to be cloned not to send the same object which was modified
TxAck(tx=TransactionType(outputs=[TxOutputType(**out1.__dict__)])),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized out1
@ -178,7 +179,7 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
signature_index=None,
signature=None,
)),
TxAck(tx=TransactionType(outputs=[out2])),
TxAck(tx=TransactionType(outputs=[TxOutputType(**out2.__dict__)])),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=TxRequestSerializedType(

@ -175,8 +175,9 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
serialized_tx=unhexlify(
'0100000000010137c361fb8f2d9056ba8c98c5611930fcb48cacfdd0fe2e0449d83eea982f91200000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff'),
)),
TxAck(tx=TransactionType(outputs=[out1])),
# here
# the out has to be cloned not to send the same object which was modified
TxAck(tx=TransactionType(outputs=[TxOutputType(**out1.__dict__)])),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=TxRequestSerializedType(
# returned serialized out1
@ -185,7 +186,7 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
signature_index=None,
signature=None,
)),
TxAck(tx=TransactionType(outputs=[out2])),
TxAck(tx=TransactionType(outputs=[TxOutputType(**out2.__dict__)])),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None),
@ -284,7 +285,8 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
serialized_tx=unhexlify(
'0100000000010137c361fb8f2d9056ba8c98c5611930fcb48cacfdd0fe2e0449d83eea982f91200000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff'),
)),
TxAck(tx=TransactionType(outputs=[out1])),
# the out has to be cloned not to send the same object which was modified
TxAck(tx=TransactionType(outputs=[TxOutputType(**out1.__dict__)])),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=TxRequestSerializedType(
@ -294,7 +296,7 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
signature_index=None,
signature=None,
)),
TxAck(tx=TransactionType(outputs=[out2])),
TxAck(tx=TransactionType(outputs=[TxOutputType(**out2.__dict__)])),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None),

Loading…
Cancel
Save