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

[Feature] Update verbosity arguments to accept int or bool in getrawtransaction and searchrawtransactions #391

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

zquestz
Copy link
Contributor

@zquestz zquestz commented Jul 22, 2020

Updated the remaining Verbose/Verbosity arguments found in the RPC to handle either int or bool values. This fixes the last quirk mentioned in #385.

The updated methods were:

  • getrawtransaction
  • searchrawtransactions

Note: there is some important naming.

VerbosityLevel allows [0,1,2,true,false] to support getblock
VerboseLevel allows [0,1,true,false] to support getrawtransaction and searchrawtransactions.

Here is some sample working curl calls.

curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "getrawtransaction", "params": ["9d7cb019c6cdba505193a70e60d59b8f2145afa79065c957e05c6389630249b0"] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "getrawtransaction", "params": ["9d7cb019c6cdba505193a70e60d59b8f2145afa79065c957e05c6389630249b0",0] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "getrawtransaction", "params": ["9d7cb019c6cdba505193a70e60d59b8f2145afa79065c957e05c6389630249b0",1] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "getrawtransaction", "params": ["9d7cb019c6cdba505193a70e60d59b8f2145afa79065c957e05c6389630249b0",true] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "getrawtransaction", "params": ["9d7cb019c6cdba505193a70e60d59b8f2145afa79065c957e05c6389630249b0",false] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "searchrawtransactions", "params": ["bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx"] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "searchrawtransactions", "params": ["bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx",0] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "searchrawtransactions", "params": ["bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx",1] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "searchrawtransactions", "params": ["bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx",false] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "searchrawtransactions", "params": ["bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx",true] }' -k

Invalid calls.

curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "getrawtransaction", "params": ["9d7cb019c6cdba505193a70e60d59b8f2145afa79065c957e05c6389630249b0",2] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "getrawtransaction", "params": ["9d7cb019c6cdba505193a70e60d59b8f2145afa79065c957e05c6389630249b0","bad"] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "searchrawtransactions", "params": ["bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx",2] }' -k
curl --header "Content-Type: application/json" https://127.0.0.1:8334/ -d '{ "jsonrpc": "2.0", "id":   1, "method": "searchrawtransactions", "params": ["bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx","bad"] }' -k

@cculianu you can test and make sure it fixes the issue you brought up. =)

@cculianu
Copy link

Ok @zquestz -- I will test it today after coffee and let you know!

@cculianu
Copy link

cculianu commented Jul 22, 2020

Yep. It works. Tested with Fulcrum after removing the quirks codepath for this. (Thus sending false always). Thumbs up!

EDIT: Also tested with the quirk codepath enabled -- that is both int and bool work with Fulcrum now (although to be simplest once this lands Fulcrum will just always send bool).

@cpacia cpacia merged commit 4099a10 into master Jul 23, 2020
@cpacia cpacia deleted the raw-tx-rpc-verbosity branch March 16, 2021 17:25
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.

3 participants