Skip to content

[Bug] Tron-shkeeper tries to send money from fee-deposit to fee-deposit #21

@redacted-text

Description

@redacted-text

Recent change introduced in f229a9f caused 2 bugs:

  • scan accounts tries to send trc20 to itself
  • scan accounts tries to send trx to itself

Logs:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/celery/app/trace.py", line 453, in trace_task
    R = retval = fun(*args, **kwargs)
                 ~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/celery/app/trace.py", line 736, in __protected_call__
    return self.run(*args, **kwargs)
           ~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/app/app/tasks.py", line 481, in transfer_trx_from
    query_db2(
    ~~~~~~~~~~
    ...<2 lines>...
        one=True,
        ~~~~~~~~~
    )["private"]
    ~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

and

[2025-12-06 12:16:37,081: ERROR/ForkPoolWorker-7] Task app.tasks.transfer_trc20_from[b4d02cb0-3a31-478e-9f3e-24881db7ac0f] raised unexpected: IndexError('string index out of range')
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/celery/app/trace.py", line 453, in trace_task
    R = retval = fun(*args, **kwargs)
                 ~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/celery/app/trace.py", line 736, in __protected_call__
    return self.run(*args, **kwargs)
           ~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/app/app/tasks.py", line 104, in transfer_trc20_from
    token_balance = contract.functions.balanceOf(onetime_publ_key)
  File "/usr/local/lib/python3.13/site-packages/tronpy/contract.py", line 384, in __call__
    parameter = self._prepare_parameter(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/tronpy/contract.py", line 400, in _prepare_parameter
    parameter = trx_abi.encode_single(self.input_type, args).hex()
                ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/tronpy/abi.py", line 72, in encode_single
    return encoder(arg)
  File "/usr/local/lib/python3.13/site-packages/eth_abi/encoding.py", line 93, in __call__
    return self.encode(value)
           ~~~~~~~~~~~^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/eth_abi/encoding.py", line 132, in encode
    self.validate_value(values)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/eth_abi/encoding.py", line 127, in validate_value
    encoder.validate_value(item)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/tronpy/abi.py", line 37, in validate_value
    if not is_address(value):
           ~~~~~~~~~~^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/tronpy/keys/__init__.py", line 127, in is_address
    return is_base58check_address(value) or is_hex_address(value)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/tronpy/keys/__init__.py", line 119, in is_base58check_address
    return value[0] == "T" and len(base58.b58decode_check(value)) == 21
           ~~~~~^^^
IndexError: string index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions