chaind-eth

Queue server for ethereum
Log | Files | Refs | README | LICENSE

commit 097a6f4b532eac0f22a4734c0e166573c28d6279
parent 8d0a1f589bd31f4899a7cb46826eb2f71f7e1316
Author: lash <dev@holbrook.no>
Date:   Fri, 29 Apr 2022 06:30:12 +0000

Advance nonce on gas token txs only

Diffstat:
Mchaind/eth/token/base.py | 8++++++--
Mchaind/eth/token/gas.py | 2+-
Mrequirements.txt | 2+-
Msetup.cfg | 2+-
4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/chaind/eth/token/base.py b/chaind/eth/token/base.py @@ -9,7 +9,7 @@ logg = logging.getLogger(__name__) class BaseTokenResolver: - def __init__(self, chain_spec, sender, signer, gas_oracle, nonce_oracle): + def __init__(self, chain_spec, sender, signer, gas_oracle, nonce_oracle, advance_nonce=False): self.chain_spec = chain_spec self.chain_id = chain_spec.chain_id() self.signer = signer @@ -19,6 +19,10 @@ class BaseTokenResolver: self.factory = None self.gas_limit_start = None self.gas_price_start = None + if advance_nonce: + self.nonce_getter = self.nonce_oracle.next_nonce + else: + self.nonce_getter = self.nonce_oracle.get_nonce def reset(self): @@ -28,7 +32,7 @@ class BaseTokenResolver: def get_values(self, gas_value, value, executable_address=None): - nonce = self.nonce_oracle.get_nonce() + nonce = self.nonce_getter() if executable_address == None: return (value, 0, nonce) diff --git a/chaind/eth/token/gas.py b/chaind/eth/token/gas.py @@ -9,7 +9,7 @@ from chaind.eth.token import BaseTokenResolver class GasTokenResolver(BaseTokenResolver): def __init__(self, chain_spec, sender, signer, gas_oracle, nonce_oracle): - super(GasTokenResolver, self).__init__(chain_spec, sender, signer, gas_oracle, nonce_oracle) + super(GasTokenResolver, self).__init__(chain_spec, sender, signer, gas_oracle, nonce_oracle, advance_nonce=True) self.factory = Gas(self.chain_spec, signer=self.signer, gas_oracle=self.gas_oracle, nonce_oracle=self.nonce_oracle) diff --git a/requirements.txt b/requirements.txt @@ -1,4 +1,4 @@ -chaind~=0.1.1 +chaind~=0.1.3 hexathon~=0.1.5 chainlib-eth~=0.1.1 pyxdg~=0.27 diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chaind-eth -version = 0.1.4 +version = 0.1.5 description = Queue server for ethereum author = Louis Holbrook author_email = dev@holbrook.no