I'm trying to get the raw transaction hex string of a transaction that I know the id from.
I would like to do that without using txindex=1.
As I assume the transaction is unspent (and confirmed) I'm doing the following steps:
bitcoin-cli gettxout 'txid'
bitcoin-cli getblockhash 'blockcount - txout.confirmations + 1'
bitcoin-cli getrawtransaction 'txid' 0 'blockhash'
I have a race condition when getting the blockcount.
Is there a better way to do that?