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

cli send failing in 'Invalid params' RPCError #49

Closed
cgzzz opened this issue Mar 5, 2014 · 3 comments
Closed

cli send failing in 'Invalid params' RPCError #49

cgzzz opened this issue Mar 5, 2014 · 3 comments
Assignees

Comments

@cgzzz
Copy link

cgzzz commented Mar 5, 2014

When trying to send using the counterpartyd cli, a following error occurs:

Traceback (most recent call last):
File "/home/me/counterpartyd_build/dist/counterpartyd/counterpartyd.py", line 432, in
args.unsigned)
File "/home/me/counterpartyd_build/dist/counterpartyd/counterpartyd.py", line 41, in cli
unsigned_tx_hex = util.api(method, params)
File "/home/me/counterpartyd_build/dist/counterpartyd/lib/util.py", line 50, in api
raise exceptions.RPCError('{}'.format(response_json['error']))
lib.exceptions.RPCError: {'message': 'Invalid params', 'code': -32602}

After a while of digging it appears that the problem is a missing bytes() cast for the txin['scriptPubKey']:

bitcoin.py/serialise():

# List of Inputs.
for i in range(len(inputs)):
    txin = inputs[i]
    s += binascii.unhexlify(bytes(txin['txid'], 'utf-8'))[::-1]         # TxOutHash
    s += txin['vout'].to_bytes(4, byteorder='little')   # TxOutIndex

    # FIXME bytes() cast missing here, should be like above?
    script = binascii.unhexlify(txin['scriptPubKey'])
    s += var_int(int(len(script)))                      # Script length
    s += script                                         # Script
    s += b'\xff' * 4                                    # Sequence
@adamkrellenstein adamkrellenstein self-assigned this Mar 6, 2014
@adamkrellenstein
Copy link
Member

I can't duplicate the error, and I don't know why, but your patch seems reasonable, so I added it anyway. Thanks. 8b36d25

@cgzzz
Copy link
Author

cgzzz commented Mar 6, 2014

PhantomPhreak, thanks for confirming the correctness of the fix and committing it. It now works for me, too.

@adamkrellenstein
Copy link
Member

Thanks for submitting the issue!

chiguireitor pushed a commit to chiguireitor/counterparty-lib that referenced this issue May 25, 2017
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

2 participants