def test_mainnet_get_chainwork(self): constants.set_mainnet() blockchain.blockchains[constants.net.GENESIS] = chain_u = Blockchain( config=self.config, forkpoint=0, parent=None, forkpoint_hash=constants.net.GENESIS, prev_hash=None) open(chain_u.path(), 'w+').close() # Try a variety of checkpoint heights relative to the chunk boundary for height_offset in range(2016): constants.net.CHECKPOINTS['height']+=1 chain_u.get_chainwork(constants.net.max_checkpoint()) with self.assertRaises(MissingHeader): chain_u.get_chainwork(constants.net.max_checkpoint() + 4032)
def main(): cleanup_tmp_dir() config_options = { 'verbose': True, 'cmd': 'gui', 'gui': 'ios_native', 'cwd': os.getcwd(), } set_verbosity(str(config_options.get('verbose'))) for k, v in config_options.items(): print("config[%s] = %s" % (str(k), str(v))) constants.set_mainnet() config = SimpleConfig(config_options, read_user_dir_function=get_user_dir) gui = ElectrumGui(config) gui.main() return "Bitcoin FTW!"
def tearDownClass(cls): super().tearDownClass() constants.set_mainnet()
def wrapper(self, *args, **kwargs): constants.set_testnet() try: return func(self, *args, **kwargs) finally: constants.set_mainnet()
def tearDown(self): super().tearDown() constants.set_mainnet() shutil.rmtree(self.data_dir)