Fixes bug where decodeRawTransaction always failed#24
Open
solatis wants to merge 4 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bitcoin's rpc command
decoderawtransactionhasn't sent ahexfield for a very long time; as far as my code archaeology allowed, I wasn't able to find anyhexoutput field for decoderawtransaction since at least version 0.7: https://github.com/bitcoin/bitcoin/blob/0.7.2/src/rpcrawtransaction.cpp#L47This pull request makes the parsing of the
hexfield 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).