commit c1f236769f4b6ada68b860eccb6e567a4ee5a531
parent e33fefe4b35d9848478c3b3520a469cdeb89ef02
Author: lash <dev@holbrook.no>
Date: Sun, 10 Apr 2022 21:42:56 +0000
Add conn to execution in chaind loop
Diffstat:
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/chaind/eth/token/base.py b/chaind/eth/token/base.py
@@ -28,8 +28,10 @@ class BaseTokenResolver:
def get_values(self, gas_value, value, executable_address=None):
+ nonce = self.nonce_oracle.next_nonce()
+
if executable_address == None:
- return (value, 0)
+ return (value, 0, nonce)
try:
value = int(value)
@@ -41,8 +43,6 @@ class BaseTokenResolver:
except ValueError:
gas_value = int(strip_0x(gas_value), 16)
- nonce = self.nonce_oracle.next_nonce()
-
return (gas_value, value, nonce,)
diff --git a/chaind/eth/token/gas.py b/chaind/eth/token/gas.py
@@ -13,7 +13,7 @@ class GasTokenResolver(BaseTokenResolver):
self.factory = Gas(self.chain_spec, signer=self.signer, gas_oracle=self.gas_oracle, nonce_oracle=self.nonce_oracle)
- def create(self, recipient, gas_value, data=None, token_value=0, executable_address=None, passphrase=None):
+ def create(self, conn, recipient, gas_value, data=None, token_value=0, executable_address=None, passphrase=None):
(gas_value, token_value, nonce) = self.get_values(gas_value, token_value, executable_address=executable_address)
diff --git a/chaind/eth/token/process.py b/chaind/eth/token/process.py
@@ -84,7 +84,13 @@ class Processor:
logg.debug('gasvalue {}'.format(gas_value))
data = '0x'
- tx = self.resolver.create(self.conn, r[0], gas_value, data=data, token_value=value, executable_address=r[2])
+ executable_address = None
+ try:
+ executable_address = r[2]
+ except IndexError:
+ pass
+
+ tx = self.resolver.create(self.conn, r[0], gas_value, data=data, token_value=value, executable_address=executable_address)
v = self.resolver.sign(tx)
self.cursor += 1