1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

feat(common): enable taproot for Fujicoin, fix xpub versions

* fix fujicoin params

* add test_fujicoin/test_send_p2tr

* fix test

* fix serialized_tx.hex()

* Recreated based on a new transaction

* make gen, some fixes

Co-authored-by: matejcik <ja@matejcik.cz>
This commit is contained in:
FujiCoin 2022-01-05 20:43:34 +09:00 committed by GitHub
parent b0e0280465
commit 33c243be8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 6 deletions

View File

@ -17,13 +17,13 @@
"xprv_magic": 76066276, "xprv_magic": 76066276,
"xpub_magic_segwit_p2sh": 77429938, "xpub_magic_segwit_p2sh": 77429938,
"xpub_magic_segwit_native": 78792518, "xpub_magic_segwit_native": 78792518,
"xpub_magic_multisig_segwit_p2sh": 76066276, "xpub_magic_multisig_segwit_p2sh": 43365439,
"xpub_magic_multisig_segwit_native": 76066276, "xpub_magic_multisig_segwit_native": 44728019,
"bech32_prefix": "fc", "bech32_prefix": "fc",
"cashaddr_prefix": null, "cashaddr_prefix": null,
"slip44": 75, "slip44": 75,
"segwit": true, "segwit": true,
"taproot": false, "taproot": true,
"decred": false, "decred": false,
"fork_id": null, "fork_id": null,
"force_bip143": false, "force_bip143": false,

View File

@ -804,13 +804,13 @@ def by_name(name: str) -> CoinInfo:
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
xpub_magic_segwit_p2sh=0x049d7cb2, xpub_magic_segwit_p2sh=0x049d7cb2,
xpub_magic_segwit_native=0x04b24746, xpub_magic_segwit_native=0x04b24746,
xpub_magic_multisig_segwit_p2sh=0x0488ade4, xpub_magic_multisig_segwit_p2sh=0x0295b43f,
xpub_magic_multisig_segwit_native=0x0488ade4, xpub_magic_multisig_segwit_native=0x02aa7ed3,
bech32_prefix="fc", bech32_prefix="fc",
cashaddr_prefix=None, cashaddr_prefix=None,
slip44=75, slip44=75,
segwit=True, segwit=True,
taproot=False, taproot=True,
fork_id=None, fork_id=None,
force_bip143=False, force_bip143=False,
decred=False, decred=False,

View File

@ -0,0 +1,49 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2021 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import pytest
from trezorlib import btc, messages
from trezorlib.tools import parse_path
TXHASH_33043a = bytes.fromhex(
"33043a28cfa924ca701983e628615559ed2b68c0c14eb706b3970fa8dd4b5209"
)
pytestmark = pytest.mark.altcoin
def test_send_p2tr(client):
inp1 = messages.TxInputType(
# fc1prr07akly3xjtmggue0p04vghr8pdcgxrye2s00sahptwjeawxrkq2rxzr7
address_n=parse_path("86'/75'/0'/0/1"),
amount=99997780000,
prev_hash=TXHASH_33043a,
prev_index=0,
script_type=messages.InputScriptType.SPENDTAPROOT,
)
out1 = messages.TxOutputType(
# 86'/75'/0'/0/0
address="fc1pxax0eaemn9fg2vfwvnz8wr2fjtr5e8junp50vx3yvx8aauv0hcvql824ml",
amount=99996670000,
script_type=messages.OutputScriptType.PAYTOADDRESS,
)
_, serialized_tx = btc.sign_tx(client, "Fujicoin", [inp1], [out1])
# https://explorer.fujicoin.org/tx/a1c6a81f5e8023b17e6e3e51e2596d5b5e1d4914ea13c0c31cef90b3c3edee86
assert (
serialized_tx.hex()
== "0100000000010109524bdda80f97b306b74ec1c0682bed59556128e6831970ca24a9cf283a04330000000000ffffffff013018444817000000225120374cfcf73b995285312e64c4770d4992c74c9e5c9868f61a24618fdef18fbe180140310d04b3f7ec9c6bbc334254b5cb160d071368b3718a1e69a9f9c8c32634046cafc156115c223520eb061e5004e3f682973ed1c441b4cb9581a3ac08540227ee00000000"
)

View File

@ -51,6 +51,7 @@
"bitcoin-test_descriptors.py::test_descriptors[Testnet-1-InputScriptType.SPENDTAPROOT-tr([5c-ddc924d3": "fe4691af27c7221ac650927a4ee64aeb17ba323f746a03763d053a8311f6633b", "bitcoin-test_descriptors.py::test_descriptors[Testnet-1-InputScriptType.SPENDTAPROOT-tr([5c-ddc924d3": "fe4691af27c7221ac650927a4ee64aeb17ba323f746a03763d053a8311f6633b",
"bitcoin-test_descriptors.py::test_descriptors[Testnet-1-InputScriptType.SPENDWITNESS-wpkh([-996ae319": "3181b25e844eb1047d2904abb1099029c5f5ae4ba4d333be21336d1a745aafe0", "bitcoin-test_descriptors.py::test_descriptors[Testnet-1-InputScriptType.SPENDWITNESS-wpkh([-996ae319": "3181b25e844eb1047d2904abb1099029c5f5ae4ba4d333be21336d1a745aafe0",
"bitcoin-test_firo.py::test_spend_lelantus": "7b68b613a1ed9dc03c0416d8b86353effdaaacb703dcc40bbf7b8dbcd6254745", "bitcoin-test_firo.py::test_spend_lelantus": "7b68b613a1ed9dc03c0416d8b86353effdaaacb703dcc40bbf7b8dbcd6254745",
"bitcoin-test_fujicoin.py::test_send_p2tr": "18bdbbceedee99f00b4f23d0b78b8e6b4d17b3eaced0cd13010188cc49747230",
"bitcoin-test_getaddress.py::test_bch": "c09de07fbbf1e047442180e2facb5482d06a1a428891b875b7dd93c9e4704ae1", "bitcoin-test_getaddress.py::test_bch": "c09de07fbbf1e047442180e2facb5482d06a1a428891b875b7dd93c9e4704ae1",
"bitcoin-test_getaddress.py::test_bch_multisig": "e3dbcee904b54393c3a6d4488fc6cb3c621c1cc907795061c6a05bc2d335cad1", "bitcoin-test_getaddress.py::test_bch_multisig": "e3dbcee904b54393c3a6d4488fc6cb3c621c1cc907795061c6a05bc2d335cad1",
"bitcoin-test_getaddress.py::test_btc": "c09de07fbbf1e047442180e2facb5482d06a1a428891b875b7dd93c9e4704ae1", "bitcoin-test_getaddress.py::test_btc": "c09de07fbbf1e047442180e2facb5482d06a1a428891b875b7dd93c9e4704ae1",