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

Do Kwon’s Detention Prolonged Until 2024 As Montenegro Responds To Extradition Requests

Sam Bankman-Fried Trial Begins Tomorrow: 3 Reasons Ex-SEC Official Foresees Conviction

Future of Bitcoin encryption and security in a QC era