mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Adds additional unit tests to tools
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import re
|
||||
from http.client import HTTPException
|
||||
|
||||
import pisa.conf as conf
|
||||
from pisa import bitcoin_cli
|
||||
from pisa.logger import Logger
|
||||
from pisa.utils.auth_proxy import JSONRPCException
|
||||
@@ -46,18 +45,18 @@ def can_connect_to_bitcoind():
|
||||
return can_connect
|
||||
|
||||
|
||||
def in_correct_network():
|
||||
def in_correct_network(network):
|
||||
mainnet_genesis_block_hash = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
|
||||
testnet3_genesis_block_hash = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
|
||||
correct_network = False
|
||||
|
||||
genesis_block_hash = bitcoin_cli.getblockhash(0)
|
||||
|
||||
if conf.BTC_NETWORK == 'mainnet' and genesis_block_hash == mainnet_genesis_block_hash:
|
||||
if network == 'mainnet' and genesis_block_hash == mainnet_genesis_block_hash:
|
||||
correct_network = True
|
||||
elif conf.BTC_NETWORK == 'testnet' and genesis_block_hash == testnet3_genesis_block_hash:
|
||||
elif network == 'testnet' and genesis_block_hash == testnet3_genesis_block_hash:
|
||||
correct_network = True
|
||||
elif conf.BTC_NETWORK == 'regtest' and genesis_block_hash not in [mainnet_genesis_block_hash, testnet3_genesis_block_hash]:
|
||||
elif network == 'regtest' and genesis_block_hash not in [mainnet_genesis_block_hash, testnet3_genesis_block_hash]:
|
||||
correct_network = True
|
||||
|
||||
return correct_network
|
||||
|
||||
Reference in New Issue
Block a user