Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable 'reward' referenced before assignment #34

Open
smacrineanu opened this issue Nov 17, 2022 · 0 comments
Open

Variable 'reward' referenced before assignment #34

smacrineanu opened this issue Nov 17, 2022 · 0 comments

Comments

@smacrineanu
Copy link

Describe the bug
The get_reward() function from arweave_lib.py fails randomly because of poor variable usage.

My guess is that the following code fails when the status.code is different than 200.

if response.status_code == 200:
            reward = response.text

return reward

Here is the traceback:

File "/home/user/.local/lib/python3.8/site-packages/arweave/arweave_lib.py", line 192, in sign
  data_to_sign = self.get_signature_data()
File "/home/user/.local/lib/python3.8/site-packages/arweave/arweave_lib.py", line 204, in get_signature_data
  self.reward = self.get_reward(self.data_size, target_address=self.target if len(self.target) > 0 else None)
File "/home/user/.local/lib/python3.8/site-packages/arweave/arweave_lib.py", line 178, in get_reward
  return reward
UnboundLocalError: local variable 'reward' referenced before assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant