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

'"NoneType" object is not subscriptable' error from bitcoind returning blank transaction #4

Closed
robby-d opened this issue Jan 3, 2014 · 3 comments
Assignees
Labels

Comments

@robby-d
Copy link
Contributor

robby-d commented Jan 3, 2014

It seems that bitcoind's getrawtransaction sometimes returns an empty/blank transaction for some people, which causes the following error:

Traceback (most recent call last):
  File "/home/local/counterpartyd_build/dist/counterpartyd/counterpartyd.py", line 504, in <module>
    blocks.follow()
  File "/home/local/counterpartyd_build/dist/counterpartyd/lib/blocks.py", line 402, in follow
    source, destination, btc_amount, fee, data = get_tx_info(tx)
  File "/home/local/counterpartyd_build/dist/counterpartyd/lib/blocks.py", line 307, in get_tx_info
    for vout in tx['vout']:
TypeError: 'NoneType' object is not subscriptable

In my case, I tried rerunning bitcoind with --txindex=1 --reindex=1 to no avail. Same issue (although I'm not ruling out user error on my end :).

This happens due to bitcoind's JSON RPC getrawtransaction returning:

{'result': None, 'id': 0, 'error': {'message': 'No information available about transaction', 'code': -5}}

Two recommended things:

  • Do better error checking from bitcoind api responses (especially where there is an 'error' attribute or "'result': None" in the data output)
  • Figure out why bitcoind is returning this in some cases, and address
@ghost ghost assigned adamkrellenstein Jan 3, 2014
@robby-d
Copy link
Contributor Author

robby-d commented Jan 3, 2014

btc4ever's hack at https://bitcointalk.org/index.php?topic=395761.msg4281925#msg4281925 seemed to fix for me, but I'm not sure if it's the best approach.

@robby-d
Copy link
Contributor Author

robby-d commented Jan 3, 2014

Nevermind, I had counterpartyd accessing a different bitcoind instance on my machine that was not using txindex=1 ...modified it to use one that did.

Enhancing counterpartyd to provide this feedback (e.g. "do you have txindex=1 in your bitcoind.conf file??") on reception of this error would be helpful I think.

@adamkrellenstein
Copy link
Member

Nevermind, I had counterpartyd accessing a different bitcoind instance on
my machine that was not using txindex=1 ...modified it to use one that
did.

Enhancing counterpartyd to provide this feedback (e.g. "do you have
txindex=1 in your bitcoind.conf file??") on reception of this error would
be helpful I think.


Reply to this email directly or view it on GitHub:
#4 (comment)

Done. Good call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants