throw error when invalid wallet is specified

This commit is contained in:
Job Evers-Meltzer 2016-10-04 13:59:04 -05:00
parent 0ecfad0ae9
commit a71e87a398

View file

@ -313,6 +313,8 @@ class Daemon(jsonrpc.JSONRPC):
else: else:
log.info("Using the default wallet type %s", DEFAULT_WALLET) log.info("Using the default wallet type %s", DEFAULT_WALLET)
self.wallet_type = DEFAULT_WALLET self.wallet_type = DEFAULT_WALLET
if self.wallet_type not in conf.WALLET_TYPES:
raise ValueError('Wallet Type {} is not valid'.format(wallet_type))
# #
#### ####
self.delete_blobs_on_remove = self.session_settings['delete_blobs_on_remove'] self.delete_blobs_on_remove = self.session_settings['delete_blobs_on_remove']
@ -1063,10 +1065,7 @@ class Daemon(jsonrpc.JSONRPC):
log.info("Using PTC wallet") log.info("Using PTC wallet")
d = defer.succeed(PTCWallet(self.db_dir)) d = defer.succeed(PTCWallet(self.db_dir))
else: else:
# TODO: should fail here. Can't switch to lbrycrd because the wallet_dir, conf and path won't be set raise ValueError('Wallet Type {} is not valid'.format(self.wallet_type))
log.info("Requested unknown wallet '%s', using default lbryum", self.wallet_type)
d = defer.succeed(LBRYumWallet(self.db_dir))
d.addCallback(lambda wallet: {"wallet": wallet}) d.addCallback(lambda wallet: {"wallet": wallet})
return d return d