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

Add missing import in chain_state query #559

Closed
wants to merge 1 commit into from

Conversation

@nkostoulas
Copy link

commented Aug 7, 2018

Missing Base58Error import
Also query method was querying 'items' as well (that's how I figured out the missing import), so I've set args starting from 1

@coveralls

This comment has been minimized.

Copy link

commented Aug 7, 2018

Coverage Status

Coverage remained the same at 56.464% when pulling 28e4359 on nkostoulas:query_bug into 74e6fe4 on kyuupichan:master.

@kyuupichan

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2018

Can you give an example of what you mean by "it's querying items"? That would be something to fix in electrumx_rpc

@nkostoulas

This comment has been minimized.

Copy link
Author

commented Aug 7, 2018

I mean args is a dict like:
[‘items’ ‘addr1’ ‘addr2’ ...]

And the loop in query attemps to get a hex from args[0] i.e. ‘items’.

@kyuupichan

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2018

Well that is what needs to be understood and fixed; ignoring an argument is not the answer. I'm not clear on why this worked fine for me

@kyuupichan

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2018

This works fine for me:

$ ./electrumx_rpc query --limit 1 76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac
Script: 76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac
History #0: height 123,723 tx_hash 3387418aaddb4927209c5032f515aa442a6587d6e54677f08a03b8fa7789e688
UTXO #1: tx_hash 9aa497bf000b20f5ec5dc512bb6c1b60b68fc584d38b292b434e839ea8807bf0 tx_pos 0 height 254,148 value 5,500
Balance: 17.8983303 BCH

Also with an address:

$ ./electrumx_rpc query --limit 2 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
Address: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
History #0: height 123,723 tx_hash 3387418aaddb4927209c5032f515aa442a6587d6e54677f08a03b8fa7789e688
History #1: height 127,280 tx_hash 4574958d135e66a53abf9c61950aba340e9e140be50efeea9456aa9f92bf40b5
UTXO #1: tx_hash 9aa497bf000b20f5ec5dc512bb6c1b60b68fc584d38b292b434e839ea8807bf0 tx_pos 0 height 254,148 value 5,500
UTXO #2: tx_hash 1c998142a5a5aae6f8c1eab245351413fe8d4032a3f14345f9943a0d0bc90ec0 tx_pos 0 height 254,161 value 5,500
Balance: 17.8983303 BCH

The bug is simply the missing import:

$ ./electrumx_rpc query --limit 2 1A1zP1eP5QGefi2D
error making request: RPCError(-32603, 'internal server error')

when neither a script hash nor an address is passed. So I don't understand your point about "items"

@nkostoulas

This comment has been minimized.

Copy link
Author

commented Aug 7, 2018

You're right I misinterpreted the help instructions. I'll remove that change.

@nkostoulas nkostoulas force-pushed the nkostoulas:query_bug branch from a5c357e to 28e4359 Aug 7, 2018

kyuupichan added a commit that referenced this pull request Aug 7, 2018

Better handle bad input to query RPC call
Based on #559.  Also:

- remove unused import
- restore timeout to 15s
- handle invalid input by catching at a higher level
  and converting to RPCError
@kyuupichan

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2018

I fixed this in a3afab8

If you still have a problem with "items" can you open an issue. Thanks

@kyuupichan kyuupichan closed this Aug 7, 2018

@nkostoulas nkostoulas deleted the nkostoulas:query_bug branch Aug 7, 2018

shyba added a commit to lbryio/electrumx that referenced this pull request Oct 16, 2018

Better handle bad input to query RPC call
Based on kyuupichan#559.  Also:

- remove unused import
- restore timeout to 15s
- handle invalid input by catching at a higher level
  and converting to RPCError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.