new TrackingWalletName class
This commit is contained in:
parent
ede7353ea2
commit
edfa94e3bb
3 changed files with 14 additions and 2 deletions
|
|
@ -395,6 +395,12 @@ class MMGenWalletLabel(MMGenLabel):
|
|||
max_len = 48
|
||||
desc = 'wallet label'
|
||||
|
||||
class TrackingWalletName(MMGenLabel):
|
||||
max_len = 40
|
||||
desc = 'tracking wallet name'
|
||||
allowed = 'abcdefghijklmnopqrstuvwxyz0123456789-_'
|
||||
first_char = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
|
||||
class TwComment(MMGenLabel):
|
||||
max_screen_width = 80
|
||||
desc = 'tracking wallet comment'
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ proto.btc.rpc: Bitcoin base protocol RPC client class
|
|||
import os
|
||||
|
||||
from ...base_obj import AsyncInit
|
||||
from ...obj import TrackingWalletName
|
||||
from ...util import ymsg,die,fmt
|
||||
from ...fileutil import get_lines_from_file
|
||||
from ...rpc import RPCClient,auth_data
|
||||
|
|
@ -127,7 +128,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 cfg.tw_name or self.dfl_twname
|
||||
self.twname = TrackingWalletName(cfg.regtest_user or cfg.tw_name or self.dfl_twname)
|
||||
|
||||
super().__init__(
|
||||
cfg = cfg,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ test.objtest_py_d.ot_btc_mainnet: BTC mainnet test vectors for MMGen data object
|
|||
|
||||
from decimal import Decimal
|
||||
|
||||
from mmgen.obj import Int,MMGenTxID,CoinTxID,MMGenWalletLabel,MMGenTxComment,MMGenPWIDString
|
||||
from mmgen.obj import Int,MMGenTxID,CoinTxID,MMGenWalletLabel,MMGenTxComment,MMGenPWIDString,TrackingWalletName
|
||||
from mmgen.addrlist import AddrIdx,AddrIdxList,AddrListID
|
||||
from mmgen.seed import Seed,SeedID
|
||||
from mmgen.subseed import SubSeedList,SubSeedIdx,SubSeedIdxRange
|
||||
|
|
@ -180,6 +180,11 @@ tests = {
|
|||
{'id_str':'F00BAA12:S:9999999', 'proto':proto},
|
||||
),
|
||||
},
|
||||
'TrackingWalletName': {
|
||||
'arg1': 's',
|
||||
'bad': ('-abcdefg', 'a' * 50, 'abc-α-ω'),
|
||||
'good': ('ab-cd-def_ghi-', '321-abcd')
|
||||
},
|
||||
'TwLabel': {
|
||||
'arg1': 'proto',
|
||||
'exc_name': 'BadTwLabel',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue