4

Scenario:

You are running a bitcoind node and listening to the incoming blocks/transactions. You receive TX 1 which is put into your mempool. Block A is mined, and includes TX 1, which is subsequently removed from your mempool. Blocks B and C are mined, orphaning Block A. Neither Block B, nor C include TX 1, so it is put back into the mempool to be included in a new Block

Question:

How exactly does the node find out that it needs to include TX1 in the mempool again? Is TX 1 broadcast and received in the same way as when it was first broadcast to the node? Or in other words, if I'm listening for receiving incoming blocks/transactions, will it be relayed to me a second time or does the client "know" just to put it back in the mempool?

Let me know if any of my understanding is incorrect or if you need any more clarification!

3

Bitcoin Core includes code which rolls back a block from the chain when it is orphaned. All transactions from that block are checked against the new best block chain to see if they've already been added to a block or if they spend the same input as a transaction already added to a block; if they aren't---meaning they're valid transactions on the new best block chain---they're re-added to the memory pool.

The re-added transactions will not be automatically rebroadcast like a newly-received transaction, but if a remote peer sends the mempool message to the local peer, the local peer will tell the remote peer about the transaction (using a standard inventory).

0

The sender and the receiver carry the burden of rebroadcasting the transaction: https://en.bitcoin.it/wiki/Network#Standard_relaying

Usually, if a transaction is included in an orphan, it also was included in the sibling block of that orphan. This is because most miners have the same transaction selection policies and would also want to collect on the transaction fee(s).

If there are any issues, you can also MANUALLY rebroadcast via JSON-RPC or bitcoind or Bitcoin-qt debug console: https://en.bitcoin.it/wiki/Raw_Transactions#Re-broadcast_a_transaction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.