def setchain(self, chaincode): """Set the chain that your wallet is currently using.""" if not chainparams.is_known_chain(chaincode): return 'Invalid chain: "{}"'.format(chaincode) if self.config.get_active_chain_code() == chaincode: return 'Active chain is already {}'.format(chaincode) self.config.set_active_chain_code(chaincode) self.network.switch_to_active_chain() return 'Active chain is now {}'.format(self.config.get_active_chain_code())
def setchain(self, chaincode): """Set the chain that your wallet is currently using.""" if not chainparams.is_known_chain(chaincode): return 'Invalid chain: "{}"'.format(chaincode) if self.config.get_active_chain_code() == chaincode: return 'Active chain is already {}'.format(chaincode) self.config.set_active_chain_code(chaincode) self.network.switch_to_active_chain() return 'Active chain is now {}'.format( self.config.get_active_chain_code())
def set_active_chain_code(self, value, save = True): """Easy way to account for the config being divided by chain indices""" value = value.upper() if not chainparams.is_known_chain(value): return False with self.lock: self.user_config['active_chain_code'] = value chainparams.set_active_chain(value) # Make an empty dict if nothing is there if self.user_config.get(value, None) is None: self.user_config[value] = {} if save: self.save_user_config() return True
def set_active_chain_code(self, value, save=True): """Easy way to account for the config being divided by chain indices""" value = value.upper() if not chainparams.is_known_chain(value): return False with self.lock: self.user_config['active_chain_code'] = value chainparams.set_active_chain(value) # Make an empty dict if nothing is there if self.user_config.get(value, None) is None: self.user_config[value] = {} if save: self.save_user_config() return True
def set_chain_config(self, chaincode, value): '''Convenience method for setting a chain's config dict''' if not chainparams.is_known_chain(chaincode): return False return self.set_key_above_chain(chaincode, value)