I suspect there is no good way to do it.
However is there any sub-optimal way to find the transaction that spends a transaction output (knowing the
index) with Bitcoin RPC?
This was the more general question. In my case:
- When I receive the TXO, it's actually an UTXO.
- I am only interested in confirmed transactions.
The only way I can come up with to answer both questions is iterating through all the transactions of all the blocks from the TXO's block to the last received block and the mempool. Or in my case, I don't mind the mempool.
Nevertheless this is cumbersome and likely I'd be better off with some kind of indexer. Is there better way to do it with RPC?