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

JSON value of type string is not of expected type array on `testmempoolaccept' #33

Open
MPins opened this issue Dec 11, 2024 · 5 comments

Comments

@MPins
Copy link
Contributor

MPins commented Dec 11, 2024


JSONRPCException Traceback (most recent call last)
Cell In[15], line 3
1 # Do not brodcast, try changing it first
2 node.sendrawtransaction(signed_tx.hex())
----> 3 node.testmempoolaccept(signed_tx.hex())

File ~/bitcoin/test/functional/test_framework/coverage.py:49, in AuthServiceProxyWrapper.call(self, *args, **kwargs)
43 def call(self, *args, **kwargs):
44 """
45 Delegates to AuthServiceProxy, then writes the particular RPC method
46 called to a file.
47
48 """
---> 49 return_val = self.auth_service_proxy_instance.call(*args, **kwargs)
50 self._log_call()
51 return return_val

File ~/bitcoin/test/functional/test_framework/authproxy.py:144, in AuthServiceProxy.call(self, *args, **argsn)
142 response, status = self._request('POST', self.__url.path, postdata.encode('utf-8'))
143 if response['error'] is not None:
--> 144 raise JSONRPCException(response['error'], status)
145 elif 'result' not in response:
146 raise JSONRPCException({
147 'code': -343, 'message': 'missing JSON-RPC result'}, status)

JSONRPCException: Wrong type passed:
{
"Position 1 (rawtxs)": "JSON value of type string is not of expected type array"
} (-3)

@MPins
Copy link
Contributor Author

MPins commented Dec 11, 2024

I can investigate further if you think it is worth it.

@DariusParvin
Copy link
Collaborator

hey @MPins thanks for posting this. Could you provide some more context around how to reproduce this issue? I think you're the first so it's unclear if it's something to do with your setup or a bug in the code. This kind of bug seems unexpected. Could you also include what version of bitcoin core you're running in case that's the issue too.

@MPins
Copy link
Contributor Author

MPins commented Dec 13, 2024

I 'm just following the Chapter1-legacy -> Maleability of ECDSA and before broadcast the transaction (on regtest mode) I tried the testmempoolaccept where I got the error.

I'm running Bitcoin Core Version: 240001 (/Satoshi:24.0.1(testnode0)/).

@DariusParvin
Copy link
Collaborator

DariusParvin commented Dec 13, 2024

thanks a lot @MPins , that context helps. And yes i see the issue now. That command is using testmempoolaccept incorrectly:

node.testmempoolaccept(signed_tx.hex()) , passing in the tx hex as just a raw string, when it should be in an array e.g.:

node.testmempoolaccept(rawtxs=[signed_tx.hex()]).

If you have the chance can you try that command instead and confirm it works? If so, feel free to open a PR to fix it, or otherwise i can get round to testing it this weekend

@MPins
Copy link
Contributor Author

MPins commented Dec 14, 2024

It works perfectly!

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