Workaround missing litecoin pid file on windows.
This commit is contained in:
		
							parent
							
								
									31ed5e7142
								
							
						
					
					
						commit
						31766508b4
					
				@ -423,6 +423,7 @@ class BasicSwap():
 | 
				
			|||||||
            'last_height_checked': last_height_checked,
 | 
					            'last_height_checked': last_height_checked,
 | 
				
			||||||
            'use_segwit': chain_client_settings.get('use_segwit', False),
 | 
					            'use_segwit': chain_client_settings.get('use_segwit', False),
 | 
				
			||||||
            'use_csv': chain_client_settings.get('use_csv', True),
 | 
					            'use_csv': chain_client_settings.get('use_csv', True),
 | 
				
			||||||
 | 
					            'core_version_group': chain_client_settings.get('core_version_group', 0),
 | 
				
			||||||
            'pid': None,
 | 
					            'pid': None,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -445,6 +446,7 @@ class BasicSwap():
 | 
				
			|||||||
            self.log.debug('Reading %s rpc credentials from auth cookie %s', coin, authcookiepath)
 | 
					            self.log.debug('Reading %s rpc credentials from auth cookie %s', coin, authcookiepath)
 | 
				
			||||||
            # Wait for daemon to start
 | 
					            # Wait for daemon to start
 | 
				
			||||||
            # Test pids to ensure authcookie is read for the correct process
 | 
					            # Test pids to ensure authcookie is read for the correct process
 | 
				
			||||||
 | 
					            datadir_pid = -1
 | 
				
			||||||
            for i in range(20):
 | 
					            for i in range(20):
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    with open(pidfilepath, 'rb') as fp:
 | 
					                    with open(pidfilepath, 'rb') as fp:
 | 
				
			||||||
@ -454,7 +456,8 @@ class BasicSwap():
 | 
				
			|||||||
                except Exception:
 | 
					                except Exception:
 | 
				
			||||||
                    time.sleep(0.5)
 | 
					                    time.sleep(0.5)
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                assert(datadir_pid == cc['pid'])
 | 
					                if os.name != 'nt' or cc['core_version_group'] > 17:  # litecoin on windows doesn't write a pid file
 | 
				
			||||||
 | 
					                    assert(datadir_pid == cc['pid'])
 | 
				
			||||||
                with open(authcookiepath, 'rb') as fp:
 | 
					                with open(authcookiepath, 'rb') as fp:
 | 
				
			||||||
                    cc['rpcauth'] = fp.read().decode('utf-8')
 | 
					                    cc['rpcauth'] = fp.read().decode('utf-8')
 | 
				
			||||||
            except Exception:
 | 
					            except Exception:
 | 
				
			||||||
 | 
				
			|||||||
@ -381,6 +381,7 @@ def main():
 | 
				
			|||||||
            'blocks_confirmed': 2,
 | 
					            'blocks_confirmed': 2,
 | 
				
			||||||
            'override_feerate': 0.002,
 | 
					            'override_feerate': 0.002,
 | 
				
			||||||
            'conf_target': 2,
 | 
					            'conf_target': 2,
 | 
				
			||||||
 | 
					            'core_version_group': 18,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        'litecoin': {
 | 
					        'litecoin': {
 | 
				
			||||||
            'connection_type': 'rpc' if 'litecoin' in with_coins else 'none',
 | 
					            'connection_type': 'rpc' if 'litecoin' in with_coins else 'none',
 | 
				
			||||||
@ -391,6 +392,7 @@ def main():
 | 
				
			|||||||
            'use_segwit': True,
 | 
					            'use_segwit': True,
 | 
				
			||||||
            'blocks_confirmed': 2,
 | 
					            'blocks_confirmed': 2,
 | 
				
			||||||
            'conf_target': 2,
 | 
					            'conf_target': 2,
 | 
				
			||||||
 | 
					            'core_version_group': 17,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        'bitcoin': {
 | 
					        'bitcoin': {
 | 
				
			||||||
            'connection_type': 'rpc' if 'bitcoin' in with_coins else 'none',
 | 
					            'connection_type': 'rpc' if 'bitcoin' in with_coins else 'none',
 | 
				
			||||||
@ -401,6 +403,7 @@ def main():
 | 
				
			|||||||
            'use_segwit': True,
 | 
					            'use_segwit': True,
 | 
				
			||||||
            'blocks_confirmed': 1,
 | 
					            'blocks_confirmed': 1,
 | 
				
			||||||
            'conf_target': 2,
 | 
					            'conf_target': 2,
 | 
				
			||||||
 | 
					            'core_version_group': 18,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        'namecoin': {
 | 
					        'namecoin': {
 | 
				
			||||||
            'connection_type': 'rpc' if 'namecoin' in with_coins else 'none',
 | 
					            'connection_type': 'rpc' if 'namecoin' in with_coins else 'none',
 | 
				
			||||||
@ -412,6 +415,7 @@ def main():
 | 
				
			|||||||
            'use_csv': False,
 | 
					            'use_csv': False,
 | 
				
			||||||
            'blocks_confirmed': 1,
 | 
					            'blocks_confirmed': 1,
 | 
				
			||||||
            'conf_target': 2,
 | 
					            'conf_target': 2,
 | 
				
			||||||
 | 
					            'core_version_group': 18,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@ import subprocess
 | 
				
			|||||||
import logging
 | 
					import logging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from basicswap import __version__
 | 
					from basicswap import __version__
 | 
				
			||||||
from basicswap.basicswap import BasicSwap, Coins
 | 
					from basicswap.basicswap import BasicSwap
 | 
				
			||||||
from basicswap.http_server import HttpThread
 | 
					from basicswap.http_server import HttpThread
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user