What is the best way to check using bitcoin core RPC if a transaction is re-orged?

My current approach is to check the following:

fn is_orphaned(..) {
    let res = get_raw_transaction(txid)
    return confirmations == 0 && blockhash != null
}

Is the above way correct? And is there a more direct way of checking whether a transaction is re-orged? I am running bitcoin core with txindex = 1



from Recent Questions - Bitcoin Stack Exchange https://ift.tt/o68uCzT
via IFTTT

Popular posts from this blog

How to compute MAST commit bytes in bitcoin payment?

Isit possible to swap my MBTC into BTC

Anyone help with some tbtc?