mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 06:48:16 +00:00
chore(tests): Add payment requests to test_msg_authorize_coinjoin device test.
This commit is contained in:
parent
f6154b311e
commit
e5281b87b5
@ -21,7 +21,14 @@ from trezorlib.exceptions import TrezorFailure
|
|||||||
from trezorlib.tools import parse_path
|
from trezorlib.tools import parse_path
|
||||||
|
|
||||||
from ...tx_cache import TxCache
|
from ...tx_cache import TxCache
|
||||||
from ..signtx import request_finished, request_input, request_meta, request_output
|
from ..signtx import (
|
||||||
|
request_finished,
|
||||||
|
request_input,
|
||||||
|
request_meta,
|
||||||
|
request_output,
|
||||||
|
request_payment_req,
|
||||||
|
)
|
||||||
|
from .payment_req import make_payment_request
|
||||||
|
|
||||||
B = messages.ButtonRequestType
|
B = messages.ButtonRequestType
|
||||||
|
|
||||||
@ -87,58 +94,80 @@ def test_sign_tx(client):
|
|||||||
preauthorized=True,
|
preauthorized=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
inp1 = messages.TxInputType(
|
inputs = [
|
||||||
# seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle"
|
messages.TxInputType(
|
||||||
# 84'/1'/0'/0/0
|
# seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle"
|
||||||
# tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2
|
# 84'/1'/0'/0/0
|
||||||
amount=100000,
|
# tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2
|
||||||
prev_hash=TXHASH_e5b7e2,
|
amount=100000,
|
||||||
prev_index=0,
|
prev_hash=TXHASH_e5b7e2,
|
||||||
script_type=messages.InputScriptType.EXTERNAL,
|
prev_index=0,
|
||||||
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
|
script_type=messages.InputScriptType.EXTERNAL,
|
||||||
ownership_proof=bytearray.fromhex(
|
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
|
||||||
"534c001901016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c4000247304402207c7e55f9ad25b03f27e0f51bba5140bafb20d2f29f27dce08e8d0d8d2c4c2efc022060623701649897a8068d5d44efad69e27368e0b5d968daa487139a1367cf2444012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
|
ownership_proof=bytearray.fromhex(
|
||||||
|
"534c001901016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c4000247304402207c7e55f9ad25b03f27e0f51bba5140bafb20d2f29f27dce08e8d0d8d2c4c2efc022060623701649897a8068d5d44efad69e27368e0b5d968daa487139a1367cf2444012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
|
||||||
|
),
|
||||||
|
commitment_data=commitment_data,
|
||||||
),
|
),
|
||||||
commitment_data=commitment_data,
|
messages.TxInputType(
|
||||||
)
|
address_n=parse_path("84'/1'/0'/1/0"),
|
||||||
inp2 = messages.TxInputType(
|
amount=7289000,
|
||||||
address_n=parse_path("84'/1'/0'/1/0"),
|
prev_hash=TXHASH_65b811,
|
||||||
amount=7289000,
|
prev_index=1,
|
||||||
prev_hash=TXHASH_65b811,
|
script_type=messages.InputScriptType.SPENDWITNESS,
|
||||||
prev_index=1,
|
),
|
||||||
script_type=messages.InputScriptType.SPENDWITNESS,
|
]
|
||||||
)
|
|
||||||
|
|
||||||
# Other's coinjoined output.
|
outputs = [
|
||||||
out1 = messages.TxOutputType(
|
# Other's coinjoined output.
|
||||||
address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml",
|
messages.TxOutputType(
|
||||||
amount=50000,
|
address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml",
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
amount=50000,
|
||||||
)
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
# Our coinjoined output.
|
payment_req_index=0,
|
||||||
out2 = messages.TxOutputType(
|
),
|
||||||
address_n=parse_path("84'/1'/0'/1/1"),
|
# Our coinjoined output.
|
||||||
amount=50000,
|
messages.TxOutputType(
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
# tb1qze76uzqteg6un6jfcryrxhwvfvjj58ts0swg3d
|
||||||
)
|
address_n=parse_path("84'/1'/0'/1/1"),
|
||||||
# Our change output.
|
amount=50000,
|
||||||
out3 = messages.TxOutputType(
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
address_n=parse_path("84'/1'/0'/1/2"),
|
payment_req_index=0,
|
||||||
amount=7289000 - 50000 - 5 - 5000,
|
),
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
# Our change output.
|
||||||
)
|
messages.TxOutputType(
|
||||||
# Other's change output.
|
# tb1qr5p6f5sk09sms57ket074vywfymuthlgud7xyx
|
||||||
out4 = messages.TxOutputType(
|
address_n=parse_path("84'/1'/0'/1/2"),
|
||||||
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
amount=7289000 - 50000 - 5 - 5000,
|
||||||
amount=100000 - 50000 - 5 - 5000,
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
payment_req_index=0,
|
||||||
)
|
),
|
||||||
# Coordinator's output.
|
# Other's change output.
|
||||||
out5 = messages.TxOutputType(
|
messages.TxOutputType(
|
||||||
address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q",
|
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
||||||
amount=10,
|
amount=100000 - 50000 - 5 - 5000,
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
|
payment_req_index=0,
|
||||||
|
),
|
||||||
|
# Coordinator's output.
|
||||||
|
messages.TxOutputType(
|
||||||
|
address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q",
|
||||||
|
amount=10,
|
||||||
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
|
payment_req_index=0,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
payment_req = make_payment_request(
|
||||||
|
client,
|
||||||
|
recipient_name="www.example.com",
|
||||||
|
outputs=outputs,
|
||||||
|
change_addresses=[
|
||||||
|
"tb1qze76uzqteg6un6jfcryrxhwvfvjj58ts0swg3d",
|
||||||
|
"tb1qr5p6f5sk09sms57ket074vywfymuthlgud7xyx",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
payment_req.amount = None
|
||||||
|
|
||||||
with client:
|
with client:
|
||||||
client.set_expected_responses(
|
client.set_expected_responses(
|
||||||
@ -147,6 +176,7 @@ def test_sign_tx(client):
|
|||||||
request_input(0),
|
request_input(0),
|
||||||
request_input(1),
|
request_input(1),
|
||||||
request_output(0),
|
request_output(0),
|
||||||
|
request_payment_req(0),
|
||||||
request_output(1),
|
request_output(1),
|
||||||
request_output(2),
|
request_output(2),
|
||||||
request_output(3),
|
request_output(3),
|
||||||
@ -175,9 +205,10 @@ def test_sign_tx(client):
|
|||||||
_, serialized_tx = btc.sign_tx(
|
_, serialized_tx = btc.sign_tx(
|
||||||
client,
|
client,
|
||||||
"Testnet",
|
"Testnet",
|
||||||
[inp1, inp2],
|
inputs,
|
||||||
[out1, out2, out3, out4, out5],
|
outputs,
|
||||||
prev_txes=TX_CACHE_TESTNET,
|
prev_txes=TX_CACHE_TESTNET,
|
||||||
|
payment_reqs=[payment_req],
|
||||||
preauthorized=True,
|
preauthorized=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -190,9 +221,10 @@ def test_sign_tx(client):
|
|||||||
btc.sign_tx(
|
btc.sign_tx(
|
||||||
client,
|
client,
|
||||||
"Testnet",
|
"Testnet",
|
||||||
[inp1, inp2],
|
inputs,
|
||||||
[out1, out2, out3, out4, out5],
|
outputs,
|
||||||
prev_txes=TX_CACHE_TESTNET,
|
prev_txes=TX_CACHE_TESTNET,
|
||||||
|
payment_reqs=[payment_req],
|
||||||
preauthorized=True,
|
preauthorized=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -201,9 +233,10 @@ def test_sign_tx(client):
|
|||||||
btc.sign_tx(
|
btc.sign_tx(
|
||||||
client,
|
client,
|
||||||
"Testnet",
|
"Testnet",
|
||||||
[inp1, inp2],
|
inputs,
|
||||||
[out1, out2, out3, out4, out5],
|
outputs,
|
||||||
prev_txes=TX_CACHE_TESTNET,
|
prev_txes=TX_CACHE_TESTNET,
|
||||||
|
payment_reqs=[payment_req],
|
||||||
preauthorized=True,
|
preauthorized=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -222,66 +255,89 @@ def test_unfair_fee(client):
|
|||||||
script_type=messages.InputScriptType.SPENDWITNESS,
|
script_type=messages.InputScriptType.SPENDWITNESS,
|
||||||
)
|
)
|
||||||
|
|
||||||
inp1 = messages.TxInputType(
|
inputs = [
|
||||||
# seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle"
|
messages.TxInputType(
|
||||||
# 84'/1'/0'/0/0
|
# seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle"
|
||||||
# tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2
|
# 84'/1'/0'/0/0
|
||||||
amount=100000,
|
# tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2
|
||||||
prev_hash=TXHASH_e5b7e2,
|
amount=100000,
|
||||||
prev_index=0,
|
prev_hash=TXHASH_e5b7e2,
|
||||||
script_type=messages.InputScriptType.EXTERNAL,
|
prev_index=0,
|
||||||
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
|
script_type=messages.InputScriptType.EXTERNAL,
|
||||||
ownership_proof=bytearray.fromhex(
|
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
|
||||||
"534c001901016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c4000247304402207c7e55f9ad25b03f27e0f51bba5140bafb20d2f29f27dce08e8d0d8d2c4c2efc022060623701649897a8068d5d44efad69e27368e0b5d968daa487139a1367cf2444012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
|
ownership_proof=bytearray.fromhex(
|
||||||
|
"534c001901016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c4000247304402207c7e55f9ad25b03f27e0f51bba5140bafb20d2f29f27dce08e8d0d8d2c4c2efc022060623701649897a8068d5d44efad69e27368e0b5d968daa487139a1367cf2444012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
|
||||||
|
),
|
||||||
|
commitment_data=b"www.example.org" + (1).to_bytes(ROUND_ID_LEN, "big"),
|
||||||
),
|
),
|
||||||
commitment_data=b"www.example.org" + (1).to_bytes(ROUND_ID_LEN, "big"),
|
messages.TxInputType(
|
||||||
)
|
address_n=parse_path("84'/1'/0'/1/0"),
|
||||||
inp2 = messages.TxInputType(
|
amount=7289000,
|
||||||
address_n=parse_path("84'/1'/0'/1/0"),
|
prev_hash=TXHASH_65b811,
|
||||||
amount=7289000,
|
prev_index=1,
|
||||||
prev_hash=TXHASH_65b811,
|
script_type=messages.InputScriptType.SPENDWITNESS,
|
||||||
prev_index=1,
|
),
|
||||||
script_type=messages.InputScriptType.SPENDWITNESS,
|
]
|
||||||
)
|
|
||||||
|
|
||||||
# Other's coinjoined output.
|
outputs = [
|
||||||
out1 = messages.TxOutputType(
|
# Other's coinjoined output.
|
||||||
address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml",
|
messages.TxOutputType(
|
||||||
amount=50000,
|
address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml",
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
amount=50000,
|
||||||
)
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
# Our coinjoined output.
|
payment_req_index=0,
|
||||||
out2 = messages.TxOutputType(
|
),
|
||||||
address_n=parse_path("84'/1'/0'/1/1"),
|
# Our coinjoined output.
|
||||||
amount=50000,
|
messages.TxOutputType(
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
# tb1qze76uzqteg6un6jfcryrxhwvfvjj58ts0swg3d
|
||||||
)
|
address_n=parse_path("84'/1'/0'/1/1"),
|
||||||
# Our change output.
|
amount=50000,
|
||||||
out3 = messages.TxOutputType(
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
address_n=parse_path("84'/1'/0'/1/2"),
|
payment_req_index=0,
|
||||||
amount=7289000 - 50000 - 5 - 6000, # unfair mining fee
|
),
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
# Our change output.
|
||||||
)
|
messages.TxOutputType(
|
||||||
# Other's change output.
|
# tb1qr5p6f5sk09sms57ket074vywfymuthlgud7xyx
|
||||||
out4 = messages.TxOutputType(
|
address_n=parse_path("84'/1'/0'/1/2"),
|
||||||
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
amount=7289000 - 50000 - 5 - 6000, # unfair mining fee
|
||||||
amount=100000 - 50000 - 5 - 4000,
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
payment_req_index=0,
|
||||||
)
|
),
|
||||||
# Coordinator's output.
|
# Other's change output.
|
||||||
out5 = messages.TxOutputType(
|
messages.TxOutputType(
|
||||||
address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q",
|
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
||||||
amount=10,
|
amount=100000 - 50000 - 5 - 4000,
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
|
payment_req_index=0,
|
||||||
|
),
|
||||||
|
# Coordinator's output.
|
||||||
|
messages.TxOutputType(
|
||||||
|
address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q",
|
||||||
|
amount=10,
|
||||||
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
|
payment_req_index=0,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
payment_req = make_payment_request(
|
||||||
|
client,
|
||||||
|
recipient_name="www.example.com",
|
||||||
|
outputs=outputs,
|
||||||
|
change_addresses=[
|
||||||
|
"tb1qze76uzqteg6un6jfcryrxhwvfvjj58ts0swg3d",
|
||||||
|
"tb1qr5p6f5sk09sms57ket074vywfymuthlgud7xyx",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
payment_req.amount = None
|
||||||
|
|
||||||
with pytest.raises(TrezorFailure, match="fee over threshold"):
|
with pytest.raises(TrezorFailure, match="fee over threshold"):
|
||||||
btc.sign_tx(
|
btc.sign_tx(
|
||||||
client,
|
client,
|
||||||
"Testnet",
|
"Testnet",
|
||||||
[inp1, inp2],
|
inputs,
|
||||||
[out1, out2, out3, out4, out5],
|
outputs,
|
||||||
prev_txes=TX_CACHE_TESTNET,
|
prev_txes=TX_CACHE_TESTNET,
|
||||||
|
payment_reqs=[payment_req],
|
||||||
preauthorized=True,
|
preauthorized=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -300,78 +356,105 @@ def test_no_anonymity(client):
|
|||||||
script_type=messages.InputScriptType.SPENDWITNESS,
|
script_type=messages.InputScriptType.SPENDWITNESS,
|
||||||
)
|
)
|
||||||
|
|
||||||
inp1 = messages.TxInputType(
|
inputs = [
|
||||||
# seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle"
|
messages.TxInputType(
|
||||||
# 84'/1'/0'/0/0
|
# seed "alcohol woman abuse must during monitor noble actual mixed trade anger aisle"
|
||||||
# tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2
|
# 84'/1'/0'/0/0
|
||||||
amount=100000,
|
# tb1qnspxpr2xj9s2jt6qlhuvdnxw6q55jvygcf89r2
|
||||||
prev_hash=TXHASH_e5b7e2,
|
amount=100000,
|
||||||
prev_index=0,
|
prev_hash=TXHASH_e5b7e2,
|
||||||
script_type=messages.InputScriptType.EXTERNAL,
|
prev_index=0,
|
||||||
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
|
script_type=messages.InputScriptType.EXTERNAL,
|
||||||
ownership_proof=bytearray.fromhex(
|
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
|
||||||
"534c001901016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c4000247304402207c7e55f9ad25b03f27e0f51bba5140bafb20d2f29f27dce08e8d0d8d2c4c2efc022060623701649897a8068d5d44efad69e27368e0b5d968daa487139a1367cf2444012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
|
ownership_proof=bytearray.fromhex(
|
||||||
|
"534c001901016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c4000247304402207c7e55f9ad25b03f27e0f51bba5140bafb20d2f29f27dce08e8d0d8d2c4c2efc022060623701649897a8068d5d44efad69e27368e0b5d968daa487139a1367cf2444012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
|
||||||
|
),
|
||||||
|
commitment_data=b"www.example.org" + (1).to_bytes(ROUND_ID_LEN, "big"),
|
||||||
),
|
),
|
||||||
commitment_data=b"www.example.org" + (1).to_bytes(ROUND_ID_LEN, "big"),
|
messages.TxInputType(
|
||||||
)
|
address_n=parse_path("84'/1'/0'/1/0"),
|
||||||
inp2 = messages.TxInputType(
|
amount=7289000,
|
||||||
address_n=parse_path("84'/1'/0'/1/0"),
|
prev_hash=TXHASH_65b811,
|
||||||
amount=7289000,
|
prev_index=1,
|
||||||
prev_hash=TXHASH_65b811,
|
script_type=messages.InputScriptType.SPENDWITNESS,
|
||||||
prev_index=1,
|
),
|
||||||
script_type=messages.InputScriptType.SPENDWITNESS,
|
]
|
||||||
)
|
|
||||||
|
|
||||||
# Other's coinjoined output.
|
outputs = [
|
||||||
out1 = messages.TxOutputType(
|
# Other's coinjoined output.
|
||||||
address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml",
|
messages.TxOutputType(
|
||||||
amount=30000,
|
address="tb1qk7j3ahs2v6hrv4v282cf0tvxh0vqq7rpt3zcml",
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
amount=30000,
|
||||||
)
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
# Other's coinjoined output.
|
payment_req_index=0,
|
||||||
out2 = messages.TxOutputType(
|
),
|
||||||
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
# Other's coinjoined output.
|
||||||
amount=30000,
|
messages.TxOutputType(
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
||||||
)
|
amount=30000,
|
||||||
# Our coinjoined output.
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
out3 = messages.TxOutputType(
|
payment_req_index=0,
|
||||||
address_n=parse_path("84'/1'/0'/1/1"),
|
),
|
||||||
amount=50000,
|
# Our coinjoined output.
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
messages.TxOutputType(
|
||||||
)
|
# tb1qze76uzqteg6un6jfcryrxhwvfvjj58ts0swg3d
|
||||||
# Our coinjoined output.
|
address_n=parse_path("84'/1'/0'/1/1"),
|
||||||
out4 = messages.TxOutputType(
|
amount=50000,
|
||||||
address_n=parse_path("84'/1'/0'/1/2"),
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
amount=50000,
|
payment_req_index=0,
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
),
|
||||||
)
|
# Our coinjoined output.
|
||||||
# Our change output.
|
messages.TxOutputType(
|
||||||
out5 = messages.TxOutputType(
|
# tb1qr5p6f5sk09sms57ket074vywfymuthlgud7xyx
|
||||||
address_n=parse_path("84'/1'/0'/1/2"),
|
address_n=parse_path("84'/1'/0'/1/2"),
|
||||||
amount=7289000 - 50000 - 50000 - 10 - 5000,
|
amount=50000,
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
)
|
payment_req_index=0,
|
||||||
# Other's change output.
|
),
|
||||||
out6 = messages.TxOutputType(
|
# Our change output.
|
||||||
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
messages.TxOutputType(
|
||||||
amount=100000 - 30000 - 30000 - 6 - 5000,
|
# tb1qwn0s88t9r39g72m78mcaxj72sy3ct4m404xsmq
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
address_n=parse_path("84'/1'/0'/1/3"),
|
||||||
)
|
amount=7289000 - 50000 - 50000 - 10 - 5000,
|
||||||
# Coordinator's output.
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
out7 = messages.TxOutputType(
|
payment_req_index=0,
|
||||||
address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q",
|
),
|
||||||
amount=16,
|
# Other's change output.
|
||||||
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
messages.TxOutputType(
|
||||||
|
address="tb1q9cqhdr9ydetjzrct6tyeuccws9505hl96azwxk",
|
||||||
|
amount=100000 - 30000 - 30000 - 6 - 5000,
|
||||||
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
|
payment_req_index=0,
|
||||||
|
),
|
||||||
|
# Coordinator's output.
|
||||||
|
messages.TxOutputType(
|
||||||
|
address="mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q",
|
||||||
|
amount=16,
|
||||||
|
script_type=messages.OutputScriptType.PAYTOWITNESS,
|
||||||
|
payment_req_index=0,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
payment_req = make_payment_request(
|
||||||
|
client,
|
||||||
|
recipient_name="www.example.com",
|
||||||
|
outputs=outputs,
|
||||||
|
change_addresses=[
|
||||||
|
"tb1qze76uzqteg6un6jfcryrxhwvfvjj58ts0swg3d",
|
||||||
|
"tb1qr5p6f5sk09sms57ket074vywfymuthlgud7xyx",
|
||||||
|
"tb1qwn0s88t9r39g72m78mcaxj72sy3ct4m404xsmq",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
payment_req.amount = None
|
||||||
|
|
||||||
with pytest.raises(TrezorFailure, match="No anonymity gain"):
|
with pytest.raises(TrezorFailure, match="No anonymity gain"):
|
||||||
btc.sign_tx(
|
btc.sign_tx(
|
||||||
client,
|
client,
|
||||||
"Testnet",
|
"Testnet",
|
||||||
[inp1, inp2],
|
inputs,
|
||||||
[out1, out2, out3, out4, out5, out6, out7],
|
outputs,
|
||||||
prev_txes=TX_CACHE_TESTNET,
|
prev_txes=TX_CACHE_TESTNET,
|
||||||
|
payment_reqs=[payment_req],
|
||||||
preauthorized=True,
|
preauthorized=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,6 +31,13 @@ def request_orig_output(n: int, tx_hash: bytes) -> messages.TxRequest:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def request_payment_req(n):
|
||||||
|
return messages.TxRequest(
|
||||||
|
request_type=T.TXPAYMENTREQ,
|
||||||
|
details=messages.TxRequestDetailsType(request_index=n),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def request_meta(tx_hash: bytes) -> messages.TxRequest:
|
def request_meta(tx_hash: bytes) -> messages.TxRequest:
|
||||||
return messages.TxRequest(
|
return messages.TxRequest(
|
||||||
request_type=T.TXMETA,
|
request_type=T.TXMETA,
|
||||||
|
Loading…
Reference in New Issue
Block a user