mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
tools docstrings
This commit is contained in:
@@ -1,12 +1,23 @@
|
|||||||
import re
|
|
||||||
from http.client import HTTPException
|
from http.client import HTTPException
|
||||||
|
|
||||||
import pisa.conf as conf
|
import pisa.conf as conf
|
||||||
from pisa.utils.auth_proxy import AuthServiceProxy, JSONRPCException
|
from pisa.utils.auth_proxy import AuthServiceProxy, JSONRPCException
|
||||||
|
|
||||||
|
"""
|
||||||
|
Tools is a module with general methods that can used by different entities in the codebase.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
# NOTCOVERED
|
# NOTCOVERED
|
||||||
def bitcoin_cli():
|
def bitcoin_cli():
|
||||||
|
"""
|
||||||
|
An ``http`` connection with ``bitcoind`` using the ``json-rpc`` interface.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
``AuthServiceProxy``: An authenticated service proxy to ``bitcoind`` that can be used to send ``json-rpc``
|
||||||
|
commands.
|
||||||
|
"""
|
||||||
|
|
||||||
return AuthServiceProxy(
|
return AuthServiceProxy(
|
||||||
"http://%s:%s@%s:%d" % (conf.BTC_RPC_USER, conf.BTC_RPC_PASSWD, conf.BTC_RPC_HOST, conf.BTC_RPC_PORT)
|
"http://%s:%s@%s:%d" % (conf.BTC_RPC_USER, conf.BTC_RPC_PASSWD, conf.BTC_RPC_HOST, conf.BTC_RPC_PORT)
|
||||||
)
|
)
|
||||||
@@ -14,6 +25,13 @@ def bitcoin_cli():
|
|||||||
|
|
||||||
# NOTCOVERED
|
# NOTCOVERED
|
||||||
def can_connect_to_bitcoind():
|
def can_connect_to_bitcoind():
|
||||||
|
"""
|
||||||
|
Checks if the tower has connection to ``bitcoind``.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
``bool``: ``True`` if the connection can be established. ``False`` otherwise.
|
||||||
|
"""
|
||||||
|
|
||||||
can_connect = True
|
can_connect = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -25,6 +43,14 @@ def can_connect_to_bitcoind():
|
|||||||
|
|
||||||
|
|
||||||
def in_correct_network(network):
|
def in_correct_network(network):
|
||||||
|
"""
|
||||||
|
Checks if ``bitcoind`` and the tower are configured to run in the same network (``mainnet``, ``testnet`` or
|
||||||
|
``regtest``)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
``bool``: ``True`` if the network configuration matches. ``False`` otherwise.
|
||||||
|
"""
|
||||||
|
|
||||||
mainnet_genesis_block_hash = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
|
mainnet_genesis_block_hash = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
|
||||||
testnet3_genesis_block_hash = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
|
testnet3_genesis_block_hash = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
|
||||||
correct_network = False
|
correct_network = False
|
||||||
|
|||||||
Reference in New Issue
Block a user