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

Intermittent Decimal Conversion Error #146

Closed
pkahly opened this issue Sep 5, 2019 · 5 comments
Closed

Intermittent Decimal Conversion Error #146

pkahly opened this issue Sep 5, 2019 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@pkahly
Copy link
Owner

pkahly commented Sep 5, 2019

<class 'decimal.InvalidOperation'>

@pkahly pkahly self-assigned this Sep 5, 2019
@pkahly pkahly added the bug Something isn't working label Sep 5, 2019
@pkahly pkahly added this to the 0.3.0 milestone Sep 5, 2019
@pkahly
Copy link
Owner Author

pkahly commented Sep 10, 2019

Added a print statement to bitcoin_node_api.getnetworkhashps

Output and error

num_blocks: 144. height: None
num_blocks: 144. height: 594252
num_blocks: 144. height: 594251
num_blocks: 144. height: 594250
num_blocks: 144. height: 594249
num_blocks: 144. height: 594248
num_blocks: 144. height: 594247
num_blocks: 144. height: 594246
Traceback (most recent call last):
File "./main.py", line 68, in
bitcoin_alerter.run_bitcoin_alerter(config)
File "/home/philip/git/bitcoin-monitor/lib/bitcoin_alerter.py", line 16, in run_bitcoin_alerter
_run(config, alertgen)
File "/home/philip/git/bitcoin-monitor/lib/bitcoin_alerter.py", line 22, in _run
info = info_collector.get_info(config, previous_info)
File "/home/philip/git/bitcoin-monitor/lib/info_collector.py", line 69, in get_info
reorg_info = reorg.add_blocks(config, bitcoin_client)
File "/home/philip/git/bitcoin-monitor/lib/reorg.py", line 135, in add_blocks
_overwrite_blocks(bitcoin_client, config, connection, cursor, start, end)
File "/home/philip/git/bitcoin-monitor/lib/reorg.py", line 150, in _overwrite_blocks
networkhashps = bitcoin_client.get_network_hashrate(config.network_hash_duration, height)
File "/home/philip/git/bitcoin-monitor/lib/bitcoin_node_api.py", line 43, in get_network_hashrate
return self.client.getnetworkhashps(num_blocks, height)
File "/home/philip/.local/lib/python3.6/site-packages/bitcoinrpc/authproxy.py", line 139, in call
response = self._get_response()
File "/home/philip/.local/lib/python3.6/site-packages/bitcoinrpc/authproxy.py", line 192, in _get_response
log.debug("<-%s- %s"%(response["id"], json.dumps(response["result"], default=EncodeDecimal)))
File "/usr/lib/python3.6/json/init.py", line 238, in dumps
**kw).encode(obj)
File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/philip/.local/lib/python3.6/site-packages/bitcoinrpc/authproxy.py", line 77, in EncodeDecimal
return float(round(o, 8))

@pkahly
Copy link
Owner Author

pkahly commented Sep 10, 2019

Commandline results for these arguments:

$ bitcoin-cli getnetworkhashps 144 594246
1.001339980466565e+20

@pkahly
Copy link
Owner Author

pkahly commented Sep 11, 2019

Error seems to be coming from BitcoinRPC

https://github.com/jgarzik/python-bitcoinrpc/blob/master/bitcoinrpc/authproxy.py#L77

@pkahly
Copy link
Owner Author

pkahly commented Sep 14, 2019

This is a bug in bitcoinrpc.
jgarzik/python-bitcoinrpc#92

@pkahly
Copy link
Owner Author

pkahly commented Sep 14, 2019

Will patch my local bitcoinrpc installation and add a note to the instructions.

@pkahly pkahly closed this as completed Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant