Repository navigation
getrawtransaction: inform about blockhash argument when lookup fails - #16217
Conversation
| 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"; |
There was a problem hiding this comment.
No strong opinion, but generally I think error messages shouldn't mention arguments or configurations, for that we have the help message.
There was a problem hiding this comment.
Is that really a guideline? This seems very helpful, especially as the underlying API changes(no more UTXO lookup)
There was a problem hiding this comment.
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.
|
ACK, could you also update the help text, so that this is not only shown on error? |
|
@MarcoFalke it's already in the help text : bitcoin/src/rpc/rawtransaction.cpp Lines 78 to 80 in c59e3a3 |
… 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
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
…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
…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
Just 4 words added on
getrawtransactionlookup error to fix #16142