mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
core/sign_tx: Set decred_script_version to 0 by default for decred coins.
This commit is contained in:
parent
dccf415e0b
commit
c9814e50ba
@ -61,7 +61,7 @@ class Decred(Bitcoin):
|
|||||||
async def confirm_output(
|
async def confirm_output(
|
||||||
self, i: int, txo: TxOutputType, txo_bin: TxOutputBinType
|
self, i: int, txo: TxOutputType, txo_bin: TxOutputBinType
|
||||||
) -> None:
|
) -> None:
|
||||||
if txo.decred_script_version is not None and txo.decred_script_version != 0:
|
if txo.decred_script_version != 0:
|
||||||
raise SigningError(
|
raise SigningError(
|
||||||
FailureType.ActionCancelled,
|
FailureType.ActionCancelled,
|
||||||
"Cannot send to output with script version != 0",
|
"Cannot send to output with script version != 0",
|
||||||
@ -141,10 +141,7 @@ class Decred(Bitcoin):
|
|||||||
await helpers.request_tx_finish(self.tx_req)
|
await helpers.request_tx_finish(self.tx_req)
|
||||||
|
|
||||||
def check_prevtx_output(self, txo_bin: TxOutputBinType) -> None:
|
def check_prevtx_output(self, txo_bin: TxOutputBinType) -> None:
|
||||||
if (
|
if txo_bin.decred_script_version != 0:
|
||||||
txo_bin.decred_script_version is not None
|
|
||||||
and txo_bin.decred_script_version != 0
|
|
||||||
):
|
|
||||||
raise SigningError(
|
raise SigningError(
|
||||||
FailureType.ProcessError,
|
FailureType.ProcessError,
|
||||||
"Cannot use utxo that has script_version != 0",
|
"Cannot use utxo that has script_version != 0",
|
||||||
|
@ -307,8 +307,12 @@ def sanitize_tx_binoutput(tx: TransactionType, coin: CoinInfo) -> TxOutputBinTyp
|
|||||||
def _sanitize_decred(
|
def _sanitize_decred(
|
||||||
tx: Union[TxInputType, TxOutputType, TxOutputBinType], coin: CoinInfo
|
tx: Union[TxInputType, TxOutputType, TxOutputBinType], coin: CoinInfo
|
||||||
) -> None:
|
) -> None:
|
||||||
if not coin.decred and tx.decred_script_version is not None:
|
if coin.decred:
|
||||||
raise SigningError(
|
if tx.decred_script_version is None:
|
||||||
FailureType.DataError,
|
tx.decred_script_version = 0
|
||||||
"Decred details provided but Decred coin not specified.",
|
else:
|
||||||
)
|
if tx.decred_script_version is not None:
|
||||||
|
raise SigningError(
|
||||||
|
FailureType.DataError,
|
||||||
|
"Decred details provided but Decred coin not specified.",
|
||||||
|
)
|
||||||
|
@ -71,8 +71,7 @@ def write_tx_output(w: Writer, o: TxOutputBinType) -> None:
|
|||||||
|
|
||||||
def write_tx_output_decred(w: Writer, o: TxOutputBinType) -> None:
|
def write_tx_output_decred(w: Writer, o: TxOutputBinType) -> None:
|
||||||
write_uint64(w, o.amount)
|
write_uint64(w, o.amount)
|
||||||
if o.decred_script_version is not None:
|
write_uint16(w, o.decred_script_version)
|
||||||
write_uint16(w, o.decred_script_version)
|
|
||||||
write_bytes_prefixed(w, o.script_pubkey)
|
write_bytes_prefixed(w, o.script_pubkey)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user