[qa] Delete cookie file before starting node

If a cookie file exists in a datadir prior to node startup, it must have
been leftover from a prior unclean shutdown. As bitcoind will overwrite
it anyway, delete it before starting up to prevent the test framework
from inadvertently trying to connect using stale credentials.
This commit is contained in:
Suhas Daftuar
2018-04-09 14:07:47 -04:00
parent 2b54155a45
commit 75d0e4c544
2 changed files with 11 additions and 0 deletions

View File

@@ -332,6 +332,12 @@ def get_auth_cookie(datadir):
raise ValueError("No RPC credentials")
return user, password
# If a cookie file exists in the given datadir, delete it.
def delete_cookie_file(datadir):
if os.path.isfile(os.path.join(datadir, "regtest", ".cookie")):
logger.debug("Deleting leftover cookie file")
os.remove(os.path.join(datadir, "regtest", ".cookie"))
def get_bip9_status(node, key):
info = node.getblockchaininfo()
return info['bip9_softforks'][key]