|
@@ -453,27 +453,18 @@ class BitcoinRPCClient(RPCClient,metaclass=aInitMeta):
|
|
self.caps += (cap,)
|
|
self.caps += (cap,)
|
|
|
|
|
|
if caller != 'regtest':
|
|
if caller != 'regtest':
|
|
- try:
|
|
+ await self.check_tracking_wallet()
|
|
- await self.call('getbalance')
|
|
+
|
|
- except:
|
|
+ async def check_tracking_wallet(self,wallet_checked=[]):
|
|
- await self.create_tracking_wallet()
|
|
+ if not wallet_checked:
|
|
-
|
|
+ wallets = await self.call('listwallets')
|
|
- async def create_tracking_wallet(self):
|
|
+ if len(wallets) == 0:
|
|
- """
|
|
+ wname = self.daemon.tracking_wallet_name
|
|
- Quirk: when --datadir is specified (even if standard), wallet is created directly in
|
|
+ await self.icall('createwallet',wallet_name=wname)
|
|
- datadir, otherwise in datadir/wallets
|
|
+ ymsg(f'Created {self.daemon.coind_name} wallet {wname!r}')
|
|
- """
|
|
+ elif len(wallets) > 1:
|
|
- wname = self.daemon.tracking_wallet_name
|
|
+ rdie(2,f'ERROR: more than one {self.daemon.coind_name} wallet loaded: {wallets}')
|
|
- await self.call('createwallet',
|
|
+ wallet_checked.append(True)
|
|
- wname,
|
|
|
|
- True,
|
|
|
|
- True,
|
|
|
|
- '',
|
|
|
|
- False,
|
|
|
|
- False,
|
|
|
|
- True
|
|
|
|
- )
|
|
|
|
- ymsg(f'Created {self.daemon.coind_name} wallet {wname!r}')
|
|
|
|
|
|
|
|
def get_daemon_cfg_fn(self):
|
|
def get_daemon_cfg_fn(self):
|
|
|
|
|