RPC: Also serve txo from gettxout (not just utxo and mempool) #10822

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Member

jtimon commented Jul 14, 2017 edited

Expand gettxout to also serve spent txo if pruning or lack of -txindex don't get in the way.

If the output is spent, it will be slower to load, but there's no reason not to serve this if the data is there.

TODO (functional tests):

  • Test success (ideally more than one example)
  • Test error no txid
  • Test error no n for this txid
  • Test spent/unspent
  • Test txindex error
  • Test prunning error

jtimon changed the title from TOTEST: Also server txo from gettxout (not just utxo and mempool) to TOTEST: Also serve txo from gettxout (not just utxo and mempool) Jul 14, 2017

@jtimon jtimon RPC: Also serve txo from gettxout (not just utxo and mempool) efb8b71

jtimon changed the title from TOTEST: Also serve txo from gettxout (not just utxo and mempool) to RPC: Also serve txo from gettxout (not just utxo and mempool) Jul 16, 2017

Owner

sipa commented Jul 16, 2017

I don't think we should be expanding the impact of -txindex. This functionality is already available through getrawtransaction anyway.

Member

jtimon commented Jul 17, 2017

I don't think we should be expanding the impact of -txindex.

Is there a problem with that? This is just RPC anyway.
I also think making -txindex more useful may increase the incentives to run an archive full node.

My reasoning (with some errors corrected below it) is here: #9806 (comment)

This functionality is already available through getrawtransaction anyway.

By that logic, shouldn't we just fully remove gettxout?
That would be bad for gettxoutbyscript and gettxoutbyaddress though, I think.

gettxout is faster for utxo, so if one wants a txo (not knowing if stxo/utxo a priori), one could call gettxout first and only if it fails call getrawtransation. But I think a single call would be more convenient.
If not, I guess we need getoutpointfromscript and getoupointfrom address call too to serve the full txo.
One could, for example, call gettxoutbyaddress and if it fails, also call gettxoutbyaddress and getrawtransaction. It would be more cumbersome, but it would also work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment