Skip to content

Commit 0f6cc9c

Browse files
committed
Merge #234: Fix file location of .cookie when on testnet
bd3607d Fix file location of .cookie when on testnet (JSwambo) Pull request description: The data directory for the cookie file used for authentication should be `~/.bitcoin/testnet3` when connecting to bitcoin core testnet through RPC. Top commit has no ACKs. Tree-SHA512: eba0cf45793b308636331d4657994fc7ba2b7814ec48d5580540d7f2f85dedbff167038f34586832d54579f610bc3310563b3a9ba4a5e700747ac6a2b129818d
2 parents 4ccb753 + bd3607d commit 0f6cc9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bitcoin/rpc.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ def __init__(self,
183183
('http', conf['rpchost'], conf['rpcport']))
184184

185185
cookie_dir = conf.get('datadir', os.path.dirname(btc_conf_file))
186-
if bitcoin.params.NAME != "mainnet":
186+
if bitcoin.params.NAME == 'testnet':
187+
cookie_dir = os.path.join(cookie_dir, 'testnet3')
188+
elif bitcoin.params.NAME == 'regtest':
187189
cookie_dir = os.path.join(cookie_dir, bitcoin.params.NAME)
188190
cookie_file = os.path.join(cookie_dir, ".cookie")
189191
try:

0 commit comments

Comments
 (0)