tx.file: refuse to parse legacy TX files for signing ops
See 852cdeda
Instead of checking before signing, check before parsing.
This commit is contained in:
parent
955fe5aa28
commit
dd71481514
3 changed files with 11 additions and 6 deletions
|
|
@ -22,6 +22,7 @@ tx.file: Transaction file operations for the MMGen suite
|
|||
|
||||
import os, json
|
||||
|
||||
from ..cfg import gc
|
||||
from ..util import ymsg, make_chksum_6, die
|
||||
from ..obj import MMGenObject, HexStr, MMGenTxID, CoinTxID, MMGenTxComment
|
||||
|
||||
|
|
@ -133,6 +134,13 @@ class MMGenTxFile(MMGenObject):
|
|||
tx = self.tx
|
||||
tx.file_format = 'legacy'
|
||||
|
||||
if 'sign' in gc.prog_name:
|
||||
m = 'Request to sign legacy-format transaction. Has your online installation been compromised?'
|
||||
if tx.cfg.test_suite:
|
||||
ymsg(m)
|
||||
else:
|
||||
die('LegacyTxSignRequestError', m)
|
||||
|
||||
def deserialize(raw_data, *, desc):
|
||||
from ast import literal_eval
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ tx.unsigned: unsigned transaction class
|
|||
"""
|
||||
|
||||
from .completed import Completed
|
||||
from ..util import die, remove_dups
|
||||
from ..util import remove_dups
|
||||
|
||||
class Unsigned(Completed):
|
||||
desc = 'unsigned transaction'
|
||||
|
|
@ -23,11 +23,6 @@ class Unsigned(Completed):
|
|||
# Return signed object or False. Don’t exit or raise exception, unless fatal:
|
||||
async def sign(self, keys, *, tx_num_str=''):
|
||||
|
||||
if self.file_format == 'legacy': # fatal
|
||||
die('LegacyTxSignRequestError',
|
||||
'Request to sign legacy-format transaction. '
|
||||
'Has your online installation been compromised?')
|
||||
|
||||
try:
|
||||
self.check_correct_chain()
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -930,6 +930,8 @@ class CmdTestAutosign(CmdTestAutosignBase):
|
|||
if exc_exit_val:
|
||||
return do_return()
|
||||
|
||||
t.expect('compromised')
|
||||
|
||||
t.expect(
|
||||
f'{self.tx_count} {tx_desc}{suf(self.tx_count)} signed' if self.tx_count else
|
||||
f'No unsigned {tx_desc}s')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue