2 Commits

6 changed files with 23 additions and 16 deletions

View File

@@ -1,3 +1,6 @@
- 0.3.2
* Fix crash when supplying block number to block cli tool
* Allow non-pending nonce bootstrap
- 0.3.1 - 0.3.1
* Fix missing application of status on tx result * Fix missing application of status on tx result
- 0.3.0 - 0.3.0

View File

@@ -23,7 +23,7 @@ class Rpc(BaseRpc):
super(Rpc, self).__init__(EthHTTPConnection, wallet=wallet) super(Rpc, self).__init__(EthHTTPConnection, wallet=wallet)
def connect_by_config(self, config): def connect_by_config(self, config, nonce_confirmed=True):
""" """
If the standard arguments for nonce and fee price/price have been defined (which generate the configuration keys "_NONCE", "_FEE_PRICE" and "_FEE_LIMIT" respectively) , the corresponding overrides for fee and nonce generators will be defined. If the standard arguments for nonce and fee price/price have been defined (which generate the configuration keys "_NONCE", "_FEE_PRICE" and "_FEE_LIMIT" respectively) , the corresponding overrides for fee and nonce generators will be defined.
@@ -38,9 +38,9 @@ class Rpc(BaseRpc):
except KeyError: except KeyError:
pass pass
if nonce != None: if nonce != None:
self.nonce_oracle = OverrideNonceOracle(self.get_sender_address(), nonce, id_generator=self.id_generator) self.nonce_oracle = OverrideNonceOracle(self.get_sender_address(), nonce, confirmed=nonce_confirmed, id_generator=self.id_generator)
else: else:
self.nonce_oracle = RPCNonceOracle(self.get_sender_address(), self.conn, id_generator=self.id_generator) self.nonce_oracle = RPCNonceOracle(self.get_sender_address(), self.conn, confirmed=nonce_confirmed, id_generator=self.id_generator)
fee_price = None fee_price = None
fee_limit = None fee_limit = None

View File

@@ -42,12 +42,12 @@ class NonceOracle(BaseNonceOracle):
:param id_generator: json-rpc id generator :param id_generator: json-rpc id generator
:type id_generator: chainlib.connection.JSONRPCIdGenerator :type id_generator: chainlib.connection.JSONRPCIdGenerator
""" """
def __init__(self, address, id_generator=None): def __init__(self, address, id_generator=None, confirmed=None):
self.id_generator = id_generator self.id_generator = id_generator
super(NonceOracle, self).__init__(add_0x(address)) super(NonceOracle, self).__init__(add_0x(address), confirmed=confirmed)
def get_nonce(self): def get_nonce(self, confirmed=False):
"""Load initial nonce value. """Load initial nonce value.
""" """
raise NotImplementedError('Class must be extended') raise NotImplementedError('Class must be extended')
@@ -74,12 +74,12 @@ class RPCNonceOracle(NonceOracle):
:param id_generator: json-rpc id generator :param id_generator: json-rpc id generator
:type id_generator: chainlib.connection.JSONRPCIdGenerator :type id_generator: chainlib.connection.JSONRPCIdGenerator
""" """
def __init__(self, address, conn, id_generator=None): def __init__(self, address, conn, id_generator=None, confirmed=False):
self.conn = conn self.conn = conn
super(RPCNonceOracle, self).__init__(address, id_generator=id_generator) super(RPCNonceOracle, self).__init__(address, id_generator=id_generator, confirmed=confirmed)
def get_nonce(self): def get_nonce(self, confirmed=False):
"""Load and return nonce value from network. """Load and return nonce value from network.
Note! First call to next_nonce after calling get_nonce will return the same value! Note! First call to next_nonce after calling get_nonce will return the same value!
@@ -87,7 +87,7 @@ class RPCNonceOracle(NonceOracle):
:rtype: int :rtype: int
:returns: Initial nonce :returns: Initial nonce
""" """
o = nonce(self.address, id_generator=self.id_generator) o = nonce(self.address, confirmed=confirmed, id_generator=self.id_generator)
r = self.conn.do(o) r = self.conn.do(o)
n = strip_0x(r) n = strip_0x(r)
return int(n, 16) return int(n, 16)
@@ -103,13 +103,13 @@ class OverrideNonceOracle(NonceOracle):
:param id_generator: json-rpc id generator (not used) :param id_generator: json-rpc id generator (not used)
:type id_generator: chainlib.connection.JSONRPCIdGenerator :type id_generator: chainlib.connection.JSONRPCIdGenerator
""" """
def __init__(self, address, nonce, id_generator=None): def __init__(self, address, nonce, id_generator=None, confirmed=False):
self.initial_nonce = nonce self.initial_nonce = nonce
self.nonce = self.initial_nonce self.nonce = self.initial_nonce
super(OverrideNonceOracle, self).__init__(address, id_generator=id_generator) super(OverrideNonceOracle, self).__init__(address, id_generator=id_generator, confirmed=confirmed)
def get_nonce(self): def get_nonce(self, confirmed=False):
"""Returns initial nonce value set at object construction. """Returns initial nonce value set at object construction.
:rtype: int :rtype: int

View File

@@ -112,7 +112,11 @@ logg.debug('settings loaded:\n{}'.format(settings))
def get_block(settings): def get_block(settings):
hsh = None
try:
hsh = settings.get('HASH')[0] hsh = settings.get('HASH')[0]
except TypeError:
pass
r = None r = None
if hsh == None: if hsh == None:
r = get_block_number( r = get_block_number(

View File

@@ -14,7 +14,7 @@ from chainlib.eth.address import to_checksum_address
def process_settings_rpc(settings, config): def process_settings_rpc(settings, config):
rpc = chainlib.eth.cli.Rpc(settings.get('WALLET')) rpc = chainlib.eth.cli.Rpc(settings.get('WALLET'))
conn = rpc.connect_by_config(config) conn = rpc.connect_by_config(config, nonce_confirmed=True)
settings.set('CONN', conn) settings.set('CONN', conn)
settings.set('RPC_ID_GENERATOR', rpc.id_generator) settings.set('RPC_ID_GENERATOR', rpc.id_generator)

View File

@@ -1,6 +1,6 @@
[metadata] [metadata]
name = chainlib-eth name = chainlib-eth
version = 0.3.1 version = 0.3.2
description = Ethereum implementation of the chainlib interface description = Ethereum implementation of the chainlib interface
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no