Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Oct 30, 2016

There have been a few complaints such as #9040... Maybe this helps to debug them further.

Of course this also makes it impossible to discard the "leading" zeros:

Before:

> getrawtransaction f3fe5b5c0024dbb1030edd720fc1effc306a054da5a507903e8cb5663336
< 01000000014f7...

After:

> getrawtransaction f3fe5b5c0024dbb1030edd720fc1effc306a054da5a507903e8cb5663336
< parameter 1 must be of length 64 (not 60) (code -8)

@@ -147,6 +147,8 @@ uint256 ParseHashV(const UniValue& v, string strName)
strHex = v.get_str();
if (!IsHex(strHex)) // Note: IsHex("") is false
throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')");
if (256 / 4 != strHex.length())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

256 / 4 is more confusing than 32 * 2 or just 64...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed nit

@maflcko maflcko force-pushed the Mf1611-rpcParseHash64 branch from fa6e0e1 to fa32619 Compare October 31, 2016 09:47
@laanwj
Copy link
Member

laanwj commented Nov 2, 2016

Makes sense, utACK fa32619

@laanwj laanwj merged commit fa32619 into bitcoin:master Nov 2, 2016
laanwj added a commit that referenced this pull request Nov 2, 2016
fa32619 [rpc] ParseHash: Fail when length is not 64 (MarcoFalke)
@maflcko maflcko deleted the Mf1611-rpcParseHash64 branch November 2, 2016 21:42
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Dec 2, 2016
codablock pushed a commit to codablock/dash that referenced this pull request Jan 13, 2018
fa32619 [rpc] ParseHash: Fail when length is not 64 (MarcoFalke)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
fa32619 [rpc] ParseHash: Fail when length is not 64 (MarcoFalke)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 15, 2019
fa32619 [rpc] ParseHash: Fail when length is not 64 (MarcoFalke)
gandrewstone pushed a commit to BitcoinUnlimited/BitcoinUnlimited that referenced this pull request Mar 20, 2019
…ction (#1612)

bitcoin/bitcoin#10275
bitcoin/bitcoin#9042

`GetTransaction` changes are easier to review ignoring whitespace changes (add `?w=1` to the PR's URL)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants