|
|
@ -73,7 +73,6 @@ TXHASH_43d273 = bytes.fromhex(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skip_t1
|
|
|
|
|
|
|
|
def test_p2pkh_fee_bump(client):
|
|
|
|
def test_p2pkh_fee_bump(client):
|
|
|
|
inp1 = messages.TxInputType(
|
|
|
|
inp1 = messages.TxInputType(
|
|
|
|
address_n=parse_path("44h/0h/0h/0/4"),
|
|
|
|
address_n=parse_path("44h/0h/0h/0/4"),
|
|
|
@ -100,6 +99,8 @@ def test_p2pkh_fee_bump(client):
|
|
|
|
orig_index=1,
|
|
|
|
orig_index=1,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tt = client.features.model == "T"
|
|
|
|
|
|
|
|
|
|
|
|
with client:
|
|
|
|
with client:
|
|
|
|
client.set_expected_responses(
|
|
|
|
client.set_expected_responses(
|
|
|
|
[
|
|
|
|
[
|
|
|
@ -116,9 +117,9 @@ def test_p2pkh_fee_bump(client):
|
|
|
|
request_meta(TXHASH_beafc7),
|
|
|
|
request_meta(TXHASH_beafc7),
|
|
|
|
request_input(0, TXHASH_beafc7),
|
|
|
|
request_input(0, TXHASH_beafc7),
|
|
|
|
request_output(0, TXHASH_beafc7),
|
|
|
|
request_output(0, TXHASH_beafc7),
|
|
|
|
request_orig_input(0, TXHASH_50f6f1),
|
|
|
|
(tt, request_orig_input(0, TXHASH_50f6f1)),
|
|
|
|
request_orig_output(0, TXHASH_50f6f1),
|
|
|
|
(tt, request_orig_output(0, TXHASH_50f6f1)),
|
|
|
|
request_orig_output(1, TXHASH_50f6f1),
|
|
|
|
(tt, request_orig_output(1, TXHASH_50f6f1)),
|
|
|
|
request_input(0),
|
|
|
|
request_input(0),
|
|
|
|
request_output(0),
|
|
|
|
request_output(0),
|
|
|
|
request_output(1),
|
|
|
|
request_output(1),
|
|
|
@ -141,7 +142,6 @@ def test_p2pkh_fee_bump(client):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skip_t1
|
|
|
|
|
|
|
|
def test_p2wpkh_finalize(client):
|
|
|
|
def test_p2wpkh_finalize(client):
|
|
|
|
# Original input with disabled RBF opt-in, i.e. we finalize the transaction.
|
|
|
|
# Original input with disabled RBF opt-in, i.e. we finalize the transaction.
|
|
|
|
inp1 = messages.TxInputType(
|
|
|
|
inp1 = messages.TxInputType(
|
|
|
@ -302,9 +302,9 @@ def test_p2wpkh_payjoin(
|
|
|
|
orig_index=1,
|
|
|
|
orig_index=1,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
responses = [
|
|
|
|
with client:
|
|
|
|
resp
|
|
|
|
client.set_expected_responses(
|
|
|
|
for resp in [
|
|
|
|
[
|
|
|
|
request_input(0),
|
|
|
|
request_input(0),
|
|
|
|
request_meta(TXHASH_65b768),
|
|
|
|
request_meta(TXHASH_65b768),
|
|
|
|
request_orig_input(0, TXHASH_65b768),
|
|
|
|
request_orig_input(0, TXHASH_65b768),
|
|
|
@ -314,7 +314,7 @@ def test_p2wpkh_payjoin(
|
|
|
|
request_output(1),
|
|
|
|
request_output(1),
|
|
|
|
request_orig_output(1, TXHASH_65b768),
|
|
|
|
request_orig_output(1, TXHASH_65b768),
|
|
|
|
messages.ButtonRequest(code=B.SignTx),
|
|
|
|
messages.ButtonRequest(code=B.SignTx),
|
|
|
|
messages.ButtonRequest(code=B.SignTx) if fee_confirm else None,
|
|
|
|
(fee_confirm, messages.ButtonRequest(code=B.SignTx)),
|
|
|
|
request_input(0),
|
|
|
|
request_input(0),
|
|
|
|
request_meta(TXHASH_e4b5b2),
|
|
|
|
request_meta(TXHASH_e4b5b2),
|
|
|
|
request_input(0, TXHASH_e4b5b2),
|
|
|
|
request_input(0, TXHASH_e4b5b2),
|
|
|
@ -333,11 +333,7 @@ def test_p2wpkh_payjoin(
|
|
|
|
request_input(1),
|
|
|
|
request_input(1),
|
|
|
|
request_finished(),
|
|
|
|
request_finished(),
|
|
|
|
]
|
|
|
|
]
|
|
|
|
if resp is not None
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with client:
|
|
|
|
|
|
|
|
client.set_expected_responses(responses)
|
|
|
|
|
|
|
|
_, serialized_tx = btc.sign_tx(
|
|
|
|
_, serialized_tx = btc.sign_tx(
|
|
|
|
client,
|
|
|
|
client,
|
|
|
|
"Testnet",
|
|
|
|
"Testnet",
|
|
|
@ -350,7 +346,6 @@ def test_p2wpkh_payjoin(
|
|
|
|
assert serialized_tx.hex() == expected_tx
|
|
|
|
assert serialized_tx.hex() == expected_tx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skip_t1
|
|
|
|
|
|
|
|
def test_p2wpkh_in_p2sh_remove_change(client):
|
|
|
|
def test_p2wpkh_in_p2sh_remove_change(client):
|
|
|
|
# Test fee bump with change-output removal. Originally fee was 3780, now 98060.
|
|
|
|
# Test fee bump with change-output removal. Originally fee was 3780, now 98060.
|
|
|
|
|
|
|
|
|
|
|
@ -566,7 +561,6 @@ def test_tx_meld(client):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skip_t1
|
|
|
|
|
|
|
|
@pytest.mark.skip_ui
|
|
|
|
@pytest.mark.skip_ui
|
|
|
|
def test_attack_steal_change(client):
|
|
|
|
def test_attack_steal_change(client):
|
|
|
|
# Attempt to steal amount equivalent to the change in the original transaction by
|
|
|
|
# Attempt to steal amount equivalent to the change in the original transaction by
|
|
|
@ -691,7 +685,6 @@ def test_attack_false_internal(client):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skip_t1
|
|
|
|
|
|
|
|
@pytest.mark.skip_ui
|
|
|
|
@pytest.mark.skip_ui
|
|
|
|
def test_attack_fake_int_input_amount(client):
|
|
|
|
def test_attack_fake_int_input_amount(client):
|
|
|
|
# Give a fake input amount for an original internal input while giving the correct
|
|
|
|
# Give a fake input amount for an original internal input while giving the correct
|
|
|
|