support use of alternate tracking wallet with --tw-name
This commit is contained in:
parent
07dc1bde40
commit
92ab29a138
5 changed files with 20 additions and 4 deletions
|
|
@ -1 +1 @@
|
|||
14.1.dev22
|
||||
14.1.dev23
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ def help_notes_func(proto,cfg,k):
|
|||
|
||||
class help_notes:
|
||||
|
||||
def dfl_twname():
|
||||
from ..proto.btc.rpc import BitcoinRPCClient
|
||||
return BitcoinRPCClient.dfl_twname
|
||||
|
||||
def MasterShareIdx():
|
||||
from ..seedsplit import MasterShareIdx
|
||||
return MasterShareIdx
|
||||
|
|
|
|||
|
|
@ -62,15 +62,18 @@ long_opts_data = {
|
|||
--, --aiohttp-rpc-queue-len=N Use N simultaneous RPC connections with aiohttp
|
||||
--, --regtest=0|1 Disable or enable regtest mode
|
||||
--, --testnet=0|1 Disable or enable testnet
|
||||
--, --tw-name=NAME Specify alternate name for the BTC/LTC/BCH tracking
|
||||
wallet (default: ‘{tw_name}’)
|
||||
--, --skip-cfg-file Skip reading the configuration file
|
||||
--, --version Print version information and exit
|
||||
--, --bob Specify user “Bob” in MMGen regtest mode
|
||||
--, --alice Specify user “Alice” in MMGen regtest mode
|
||||
--, --carol Specify user “Carol” in MMGen regtest mode
|
||||
""",
|
||||
'code': lambda proto,s: s.format(
|
||||
'code': lambda proto,help_notes,s: s.format(
|
||||
pnm = gc.proj_name,
|
||||
cu_dfl = proto.coin,
|
||||
tw_name = help_notes('dfl_twname')
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit):
|
|||
self.proto = proto
|
||||
self.daemon = daemon
|
||||
self.call_sigs = getattr(CallSigs,daemon.id)(cfg)
|
||||
self.twname = cfg.regtest_user or self.dfl_twname
|
||||
self.twname = cfg.regtest_user or cfg.tw_name or self.dfl_twname
|
||||
|
||||
super().__init__(
|
||||
cfg = cfg,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ test.unit_tests_d.ut_rpc: RPC unit test for the MMGen suite
|
|||
|
||||
import sys,os,time
|
||||
|
||||
from mmgen.cfg import Config
|
||||
from mmgen.color import yellow,cyan
|
||||
from mmgen.util import msg,gmsg,make_timestr,pp_fmt,die
|
||||
from mmgen.protocol import init_proto
|
||||
|
|
@ -70,6 +71,7 @@ async def print_daemon_info(rpc):
|
|||
NETWORKINFO: {fmt_dict(rpc.cached["networkinfo"])}
|
||||
BLOCKCHAININFO: {fmt_dict(rpc.cached["blockchaininfo"])}
|
||||
DEPLOYMENTINFO: {fmt_dict(rpc.cached["deploymentinfo"])}
|
||||
WALLETINFO: {fmt_dict(await rpc.walletinfo)}
|
||||
""".rstrip())
|
||||
|
||||
msg('')
|
||||
|
|
@ -85,6 +87,10 @@ class init_test:
|
|||
rpc = await rpc_init(cfg, daemon.proto, backend, daemon)
|
||||
do_msg(rpc,backend)
|
||||
|
||||
if cfg.tw_name:
|
||||
wi = await rpc.walletinfo
|
||||
assert wi['walletname'] == rpc.cfg.tw_name, f'{wi["walletname"]!r} != {rpc.cfg.tw_name!r}'
|
||||
|
||||
bh = (await rpc.call('getblockchaininfo',timeout=300))['bestblockhash']
|
||||
await rpc.gathered_call('getblock',((bh,),(bh,1)),timeout=300)
|
||||
await rpc.gathered_call(None,(('getblock',(bh,)),('getblock',(bh,1))),timeout=300)
|
||||
|
|
@ -150,7 +156,10 @@ class unit_tests:
|
|||
arm_skip = ('parity',) # no prebuilt binaries for ARM
|
||||
|
||||
async def btc(self, name, ut):
|
||||
return await run_test(['btc','btc_tn'], test_cf_auth=True)
|
||||
return await run_test(
|
||||
['btc','btc_tn'],
|
||||
test_cf_auth = True,
|
||||
cfg_in = Config({'_clone': cfg, 'tw_name': 'alternate-tracking-wallet'}))
|
||||
|
||||
async def ltc(self, name, ut):
|
||||
return await run_test(['ltc','ltc_tn'], test_cf_auth=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue