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

Fixes bug where decodeRawTransaction always failed #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

solatis
Copy link

@solatis solatis commented Apr 9, 2015

Bitcoin's rpc command decoderawtransaction hasn't sent a hex field for a very long time; as far as my code archaeology allowed, I wasn't able to find any hex output field for decoderawtransaction since at least version 0.7: https://github.com/bitcoin/bitcoin/blob/0.7.2/src/rpcrawtransaction.cpp#L47

This pull request makes the parsing of the hex field optional, and hard-codes the storage of the raw transaction in this field. I would personally opt for removing the decRaw field entirely, since I cannot see it being used at all (since the parsing must have been failing at least since bitcoin 0.7).

Instead of adding the JSON that was unparsable to the error message, add
the actual error generated by Aeson so you can inspect why the JSON was
unparsable.
The bitcoind RPC interface doesn't send a "hex" field at least since
version 0.7. This patch makes the parsing of the "hex" field optional,
and in either case, always stores the raw transaction object; this is to
remain API compatible. In long term, we might want to get rid of the
decRaw field of DecodedRawTransaction since it is redundant.
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

Successfully merging this pull request may close these issues.

1 participant