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

getrawtransaction: inform about blockhash argument when lookup fails #16217

Merged
merged 1 commit into from
Jun 17, 2019

Conversation

darosior
Copy link
Member

Just 4 words added on getrawtransaction lookup error to fix #16142

@@ -196,7 +196,7 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
}
errmsg = "No such transaction found in the provided block";
} else if (!g_txindex) {
errmsg = "No such mempool transaction. Use -txindex to enable blockchain transaction queries";
errmsg = "No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries";
Copy link
Member

Choose a reason for hiding this comment

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

No strong opinion, but generally I think error messages shouldn't mention arguments or configurations, for that we have the help message.

Copy link
Member

Choose a reason for hiding this comment

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

Is that really a guideline? This seems very helpful, especially as the underlying API changes(no more UTXO lookup)

Copy link
Member

Choose a reason for hiding this comment

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

For cli usage this might be useful, but for the developer what really matters IMO is the documentation and error code in the response.

I understand the issue regarding the API change, but I'd rather see a documentation improvement than having "hints" in the errors.

@maflcko
Copy link
Member

maflcko commented Jun 17, 2019

ACK, could you also update the help text, so that this is not only shown on error?

@darosior
Copy link
Member Author

@MarcoFalke it's already in the help text :

"\nBy default this function only works for mempool transactions. When called with a blockhash\n"
"argument, getrawtransaction will return the transaction if the specified block is available and\n"
"the transaction is found in that block. When called without a blockhash argument, getrawtransaction\n"

@maflcko maflcko merged commit c59e3a3 into bitcoin:master Jun 17, 2019
maflcko pushed a commit that referenced this pull request Jun 17, 2019
… lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix #16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 11, 2020
Summary: This is a backport of Core [[bitcoin/bitcoin#16217 | PR16217]]

Test Plan:
```
$ src/bitcoin-cli getrawtransaction 1df224c31dbfbfcefe3d3de6671e53e73d6cd123628d491db9db3f1558f3110a
error code: -5
error message:
No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions.
```

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D8366
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…nt when lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix bitcoin#16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…nt when lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix bitcoin#16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…nt when lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix bitcoin#16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…nt when lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix bitcoin#16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…nt when lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix bitcoin#16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 12, 2021
…nt when lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix bitcoin#16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 13, 2021
…nt when lookup fails

c59e3a3 getrawtransaction: inform about blockhash argument when lookup fails (darosior)

Pull request description:

  Just 4 words added on `getrawtransaction` lookup error to fix bitcoin#16142

ACKs for commit c59e3a:

Tree-SHA512: 2219099c1240667527a9b1498a58818b5ff1c2ef366c498d2bb57963e828b3c87fa3e6b94be7e6463bd289ceabc13f9c9b1082134641594ba335ac400e6d63aa
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 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.

getrawtransaction fails (0.18.0)
5 participants