Add conn to execution in chaind loop

This commit is contained in:
lash 2022-04-10 21:42:56 +00:00
parent e33fefe4b3
commit c1f236769f
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 11 additions and 5 deletions

View File

@ -28,8 +28,10 @@ class BaseTokenResolver:
def get_values(self, gas_value, value, executable_address=None): def get_values(self, gas_value, value, executable_address=None):
nonce = self.nonce_oracle.next_nonce()
if executable_address == None: if executable_address == None:
return (value, 0) return (value, 0, nonce)
try: try:
value = int(value) value = int(value)
@ -41,8 +43,6 @@ class BaseTokenResolver:
except ValueError: except ValueError:
gas_value = int(strip_0x(gas_value), 16) gas_value = int(strip_0x(gas_value), 16)
nonce = self.nonce_oracle.next_nonce()
return (gas_value, value, nonce,) return (gas_value, value, nonce,)

View File

@ -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) 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) (gas_value, token_value, nonce) = self.get_values(gas_value, token_value, executable_address=executable_address)

View File

@ -84,7 +84,13 @@ class Processor:
logg.debug('gasvalue {}'.format(gas_value)) logg.debug('gasvalue {}'.format(gas_value))
data = '0x' 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) v = self.resolver.sign(tx)
self.cursor += 1 self.cursor += 1