remove use of env var MMGEN_TEST_SUITE from production code
This commit is contained in:
parent
9104df0926
commit
c514ce4f6b
6 changed files with 9 additions and 17 deletions
|
|
@ -18,14 +18,7 @@ examples/coin-daemon-info.py:
|
|||
#
|
||||
# Testing mode:
|
||||
#
|
||||
# 1) From the MMGen repository root, start the mainnet test suite daemons as follows
|
||||
# (note that Geth is the default testing daemon for ETH):
|
||||
#
|
||||
# test/start-coin-daemons.py btc ltc eth
|
||||
#
|
||||
# 2) Then run the script as follows:
|
||||
#
|
||||
# PYTHONPATH=. MMGEN_TEST_SUITE=1 examples/coin-daemon-info.py btc ltc eth
|
||||
# test/cmdtest.py -e coin_daemon_info
|
||||
#
|
||||
# Live mode:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ class Config(Lockable):
|
|||
init_term(self)
|
||||
|
||||
from .fileutil import check_or_create_dir
|
||||
check_or_create_dir(self.data_dir_root)
|
||||
check_or_create_dir(self, self.data_dir_root)
|
||||
|
||||
from .util import wrap_ripemd160
|
||||
wrap_ripemd160() # ripemd160 required by mmgen_cfg_file() in _set_cfg_from_cfg_file()
|
||||
|
|
@ -602,7 +602,7 @@ class Config(Lockable):
|
|||
|
||||
self._die_on_incompatible_opts()
|
||||
|
||||
check_or_create_dir(self.data_dir)
|
||||
check_or_create_dir(self, self.data_dir)
|
||||
|
||||
if self.debug and gc.prog_name != 'cmdtest.py':
|
||||
self.verbose = True
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ from .util import (
|
|||
strip_comments,
|
||||
)
|
||||
|
||||
def check_or_create_dir(path):
|
||||
def check_or_create_dir(cfg, path):
|
||||
try:
|
||||
os.listdir(path)
|
||||
except:
|
||||
if os.getenv('MMGEN_TEST_SUITE') and os.path.exists(path): # path is a link or regular file
|
||||
if getattr(cfg, 'test_suite', False) and os.path.exists(path): # path is a link or regular file
|
||||
from subprocess import run
|
||||
run(['rm', '-rf', str(path)])
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class Tx(BaseMessage):
|
|||
return sha256(bytes(self.raw)).hexdigest()
|
||||
|
||||
# raises exception on failure:
|
||||
def verify_sig(self, proto, account_number, backend='secp256k1'):
|
||||
def verify_sig(self, cfg, proto, account_number, backend='secp256k1'):
|
||||
sign_doc = SignDoc(
|
||||
bodyBytes = bytes(self.body),
|
||||
authInfoBytes = bytes(self.authInfo),
|
||||
|
|
@ -150,8 +150,7 @@ class Tx(BaseMessage):
|
|||
if not verify_sig(sig, msghash, pubkey):
|
||||
raise ValueError('signature verification failed')
|
||||
case 'ecdsa':
|
||||
import os
|
||||
if not os.getenv('MMGEN_TEST_SUITE'):
|
||||
if not cfg.test_suite:
|
||||
from ....util import die
|
||||
die(3, 'The `ecdsa` package is unsafe and may be used only in a testing environment')
|
||||
# ecdsa.keys.VerifyingKey.verify_digest():
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Unsigned(VmUnsigned, Completed, TxBase.Unsigned):
|
|||
tx = build_tx(self.cfg, self.proto, parms)
|
||||
self.serialized = bytes(tx).hex()
|
||||
self.coin_txid = CoinTxID(tx.txid)
|
||||
tx.verify_sig(self.proto, o['account_number'])
|
||||
tx.verify_sig(self.cfg, self.proto, o['account_number'])
|
||||
|
||||
class AutomountUnsigned(TxBase.AutomountUnsigned, Unsigned):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ def test_tx(src, cfg, vec):
|
|||
|
||||
vmsg('\n TX info:\n ' + '\n '.join(tx_info(tx, proto)) + '\n')
|
||||
|
||||
tx.verify_sig(proto, parms.account_number)
|
||||
tx.verify_sig(cfg, proto, parms.account_number)
|
||||
|
||||
pubkey = tx.authInfo.signerInfos[0].publicKey.key.data
|
||||
vec_txid2 = getattr(vec, 'txid2', None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue