Bitcoin Forum
April 20, 2021, 09:39:27 AM *
News: Latest Bitcoin Core release: 0.21.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Chain reorg question  (Read 116 times)
Gabrics
Member
**
Offline Offline

Activity: 107
Merit: 49

Just digging around


View Profile WWW
January 10, 2020, 08:26:16 PM
Merited by o_e_l_e_o (1)
 #1

Hi,

What happens after chain reorg with the transactions confirmed on the shorter chain (lets assume a somewhat possible 3 blocks reorg), but not included in the longer chain? I believe those are not in the mempool anymore as they were included in a block earlier.
Does Bitcoin core re-queues the transactions from the overwritten blocks?
Does it x-reference which transactions were included in the loosing but not he winning fork?

Can someone please someone enlighten me? Wink

Thanks
1618911567
Hero Member
*
Offline Offline

Posts: 1618911567

View Profile Personal Message (Offline)

Ignore
1618911567
Reply with quote  #2

1618911567
Report to moderator
1618911567
Hero Member
*
Offline Offline

Posts: 1618911567

View Profile Personal Message (Offline)

Ignore
1618911567
Reply with quote  #2

1618911567
Report to moderator
1618911567
Hero Member
*
Offline Offline

Posts: 1618911567

View Profile Personal Message (Offline)

Ignore
1618911567
Reply with quote  #2

1618911567
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
HeRetiK
Legendary
*
Offline Offline

Activity: 1806
Merit: 1490


the forkings will continue until morale improves


View Profile
January 10, 2020, 08:38:13 PM
 #2

Does it x-reference which transactions were included in the loosing but not he winning fork?

No. Orphaned blocks and their transactions are not stored and referenced. Some blockchain explorers may store the orphaned blocks that they received in their database for public viewing, but that's unrelated to how the Bitcoin protocol works.


What happens after chain reorg with the transactions confirmed on the shorter chain (lets assume a somewhat possible 3 blocks reorg), but not included in the longer chain? I believe those are not in the mempool anymore as they were included in a block earlier.
Does Bitcoin core re-queues the transactions from the overwritten blocks?

"The" mempool does not exist. Every node has their own mempool. That means while nodes that followed the "losing" fork will have removed the transaction from their mempool, other nodes that have been following the "winning" fork all along will still have the transactions in their mempool -- given, of course, the transactions have not yet been included in the "winning" chain as well.

jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2072
Merit: 2004


https://bit.ly/387FXHi ← lightning theory


View Profile
January 10, 2020, 08:43:18 PM
 #3

If a block is orphaned most of the transactions will normally appear in the unorphaned block anyway (especially is consensus rules aren't changed).

In addition, I'm not sure about whether they'd be recycled back into the mempool but my instinct tells me they would... I know they're recycled the other way around so the signature doesn't have to be verified twice (once entering the mempool and once entering the block) so blocks can be added a lot faster.

Gabrics
Member
**
Offline Offline

Activity: 107
Merit: 49

Just digging around


View Profile WWW
January 11, 2020, 06:37:07 AM
 #4

Thanks for the inputs.
So I conclude:
The winning fork has its own version of pending transactions (mempool) which will still have the transactions not included in the overtaking chain. The nodes which followed the shorter version for a while will not have these, but will get to know about them when these pending transactions eventually will be included in a block.

Pretty smart IMHO Smiley
nc50lc
Legendary
*
Offline Offline

Activity: 1288
Merit: 1754


Self-proclaimed Genius ㊙️


View Profile
January 11, 2020, 07:14:55 AM
 #5

Thanks for the inputs.
So I conclude:
The winning fork has its own version of pending transactions (mempool) which will still have the transactions not included in the overtaking chain. The nodes which followed the shorter version for a while will not have these, but will get to know about them when these pending transactions eventually will be included in a block.
They won't wait for those transaction to get included in a block in order to "know" them.
The transactions from the orphaned block that weren't included to the latest block(s) of the longest will be added to their mempool again.

The book: Mastering bitcoin used the term "queued up again" that lightly indicates that the node will move them from the orphaned block back to mempool.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!