orphan txes showing weirdly from Load Transaction | From Blockchain
See original GitHub issueA funny feature of the bitcoin node’s transaction index is that it never removes transactions that were in orphaned blocks. And when you ask for a transaction from electrumx, it goes straight through to the getrawtransaction
rpc call.
An orphan tx like this gets returned with:
...
"blockhash": "00000000074443862b52948e2fad85aa0bafa9e6a14dd7fdeb8ec09f5caa1673",
"confirmations": 0
}
where blockhash points to the orphaned block.
What is unfortunate though is that electron cash shows the full number of confirmations as if that block were in the chain!
(The above example witnessed on @imaginaryusername’s testnet server, while playing with giant reorgs during May 2019 upgrade testing.)
Issue Analytics
- State:
- Created 4 years ago
- Comments:17
Top Results From Across the Web
Bitcoin Q&A: Orphaned Blocks and Stuck Transactions
What happens to transactions in an orphaned block? How can I fix stuck transactions ? How do replace-by-fee (RBF) and child-pays-for-parent ...
Read more >Transactions within orphaned blocks - Bitcoin Stack Exchange
Bitcoin Core includes code which rolls back a block from the chain when it is orphaned. All transactions from that block are checked...
Read more >Bitcoin Orphan Transactions and CVE-2012-3789
Orphan transactions. When a cryptocurrency client processes a new transaction, it must gracefully handle the case in which one (or more) of the ......
Read more >5. Transactions - Mastering Bitcoin [Book] - O'Reilly
There is a limit to the number of orphan transactions stored in memory, to prevent a denial-of-service attack against bitcoin nodes. The limit...
Read more >What Is an Orphan Block? - Investopedia
Orphan blocks are valid blocks rejected from the blockchain, generally because network lag allowed another block to be accepted first.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably would but I’d have to look at it – a generic mechanism to queue up a verification for tx’s not in wallet that isn’t a total hack – is indeed needed. So yes. Likely. Maybe when I do CashAccounts I can tackle this one too.
Note that even if we did this – the particular “bug” where a reorg’d tx looks like a mempool tx will still not be fixed – but at least you can be sure if you do see conf’s on a tx – it was verified and not a potential lie from ElectrumX bad actors.
i know why this is – on wallet startup it does a more thorough checkcheck_history
or something it’s called.Whereas otherwise it just looks for the tx in the wallet.transactions cache and if there, shows it, without ever going to the blockchain.Possible workaround would be if doing Load transaction -> from blockchain to never consult the transaction cache.Normally in a normal UI sequence you wouldn’t get to “re-open” a tx that disappeared after a reorg, though. This is only if you kept the window open, or if you explicitly opened it “from blockchain”. So the bug is really the “from blockchain” bit should really go to blockchain.
Is that a good assessment of how you reproduced it?
As for it showing the tx with no confs – if ElectrumX returns a tx, there’s nothing we can do about that, really. How can we distinguish that from an orginary mempool tx? We can’t… like you said bitcoind rpc has this funny ‘feature’… right?
EDIT: Unless we do the merkle checking, like you suggested – of course! EDIT2: But no merkle checks possible for mempool tx. And this “from the blockchain” of a re-org’d tx looks like a mempool tx, right?