chainlib

Generic blockchain access library and tooling
Log | Files | Refs | README | LICENSE

commit a6b9eae745556fca4c1133168060c69cff540d01
parent d3f4da529665f427f960b295259ae28c321f9331
Author: lash <dev@holbrook.no>
Date:   Sun, 10 Apr 2022 19:05:12 +0000

Add rpc query timeout

Diffstat:
Mchainlib/connection.py | 4+++-
Mchainlib/tx.py | 2+-
Msetup.cfg | 2+-
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/chainlib/connection.py b/chainlib/connection.py @@ -102,7 +102,8 @@ class RPCConnection: } __constructors_for_chains = {} - def __init__(self, url=None, chain_spec=None, auth=None, verify_identity=True): + def __init__(self, url=None, chain_spec=None, auth=None, verify_identity=True, timeout=1.0): + self.timeout = timeout self.chain_spec = chain_spec self.location = None self.basic = None @@ -329,6 +330,7 @@ class JSONRPCHTTPConnection(HTTPConnection): req, data=data.encode('utf-8'), context=ssl_ctx, + timeout=self.timeout, ) except URLError as e: raise RPCException(e) diff --git a/chainlib/tx.py b/chainlib/tx.py @@ -8,7 +8,7 @@ class Tx: """ def __init__(self, src, block=None): - self.txs = [] self.src = src self.block = block self.block_src = None + self.index = None diff --git a/setup.cfg b/setup.cfg @@ -3,7 +3,7 @@ name=chainlib license=WTFPL2 author_email=dev@holbrook.no description=Generic blockchain access library and tooling -version=0.1.0b1 +version=0.1.0 url=https://gitlab.com/chaintools/chainlib author=Louis Holbrook