-
Notifications
You must be signed in to change notification settings - Fork 36.3k
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 working partially without -txindex is confusing #3220
Comments
And a stretch goal: there should be some functionality to query a raw transaction from the wallet rather than the blockchain. |
More than a stretch goal, IMO, a requirement. I know of several softwares used internally that rely on 'getrawtransaction' working without txindex=1. At a minimum, there must be a compatible replacement. I get the confusion angle and agree -- but people are using this feature actively, even with txindex=0. |
I understand the confusion but I don't think removing functionality is a good response, wouldn't it be better to improve the error message to be less confusing? (maybe even mention -txindex in the message...) Making it possible to query raw transactions from the wallet sounds like a good idea. Maybe as a new RPC command |
@jgarzik I think you may be misinformed. @laanwj I'm in favor of both improving the error message and a |
@sipa No reason it couldn't work for wallet transactions - the raw data is all in the wallet too, IIRC. |
We could just have another RPC that works on wallet transactions. I have had people pull txn that they have stuck many times using get rawtransactions, so I think we need to at least preserve the wallet behavior. Any opinion on adding a getblockrawtransaction ? which would replace the non-determinstic behavior we have for txindex=0 now? |
@luke-jr Sure, my main concern is not further confusing wallet operations with blockchain operations. We could of course extend |
If we're going to deprecate Maybe even split it into three commands:
Edit: alternatively, make it one command, then add flags what sources to query. This makes it possible to query multiple or all sources at once if desired. |
This allows getting raw transaction data from the wallet even if the transaction is no longer in the blockchain / mempool (for example if it got orphaned due to malleability abuse). Was also proposed in bitcoin#3220, but is urgently useful now.
|
Is there really any evidence of people using getrawtransaction without -txindex? I can't imagine how the current behaviour could be reliable for them. |
@laanwj Perhaps. Though if your transaction suddenly confirms between |
Yes, but if it confirms in that time, it may not be interesting anymore for a process monitoring the mempool. |
With the new deprecation mechanism we could mark it deprecated if |
Rather than deprecating, why not make it work without The use case I have in mind here is e.g. a Lightning node that's looking for fairly recent transactions, really doesn't need a full transaction index and can probably live with some delay in response time. |
I don't think that's really a good approach. If people have needs to index transactions in the chain, there should be better other projects for that. |
@sipa what are your thoughts on a partial index through It doesn't seem ideal having to install some middleware app in order to use second layer stuff, nor does it seem ideal for this second layer software to worry about such a basic feature as checking if a transaction is known (including all the reorg related bookkeeping). I'm not proposing a complete overhaul, but some sort of low hanging fruit compromise would be useful. |
@Sjors I don't think this is really needed. If you need to watch for a certain txid, you can add one of its output addresses to a watch-only wallet or so, rather than relying on full indexing of the chain (even if it's just the last few blocks). |
@laanwj for reference If the goal is to "force"
|
I'd be in favor of dropping the coins view cache check because it is not reliable and confusing. The remaining behavior would be:
|
There is |
How to get receive from an address in the transaction, which command used in http://chainquery.com site? |
I'd rather have this feature work partially, with clear documentation and error codes, than to make it conditional on a full I think the feature can be made complete in the longer run without @promag wrote:
I.e. it can now take a In addition, we could build on top of #10794 to allow Perhaps a future |
@Sjors Elsewhere I have suggested splitting the feature up into separate RPCs; for example EDIT: Actually an RPC already exists for the mempool version, called |
I like @jimpo's suggested above. |
So how would removing the txout check play with races, where a tx leaves the mempool right when Also mentioned earlier #3220 (comment) by @sipa. |
I think the current documentation is quite clear, and there is no pressing need to change the logic right now. Also note the issue is about 5 years old and most of the discussion no longer apply to the code in master. I suggest closing it. documentation on current master for reference:
|
@MarcoFalke The documentation at the end says "DEPRECATED: for now, it also works for transactions with unspent outputs.\n" I propose fully removing support for that because it is confusing, deprecated, and slow. I'm not in favor of changing |
If you do the step and remove the utxo lookup, you might as well remove the mempool lookup and make it explicit that the interface was changed for txes that recently moved from the mempool to the utxo set. (Tell users to use |
04da9f4 [RPC] Update getrawtransaction interface (Amiti Uttarwar) Pull request description: - stop checking unspent UTXOs for a transaction when txindex is not enabled, as per conversation here: bitcoin#3220 (comment) - code contributed by sipa Tree-SHA512: aa07353bccc14b81b7803992a25d076d6bc06d15ec7c1b85828dc10aea7e0498d9b49f71783e352ab8a14b0bb2010cfb7835de3dfd1bc6f2323f460449348e66
I think we should make getrawtransaction fail entirely if no txindex is enabled, instead of only working on not-fully-spent transactions, with a confusing error message otherwise.
The text was updated successfully, but these errors were encountered: