2

I am not clear as to how the removal of transactions from the non-confirmed pool happens. I have not found any descriptions explaining how the process works.

Here are the scenarios as I see them:

A) When a node selects a set of transactions to be included in a possible block it removes them from the non-confirmed pool. So if/when the node solves the block there is no clean up necessary of the not-confirmed pool.

B) Transactions may be included in multiple potential blocks and remain in the not-confirmed pool while blocks are being solved, then when a block is solved the transactions included in the block are removed from the not-confirmed pool. This sounds to me as the most likely scenario but it is not clear at all who/when removes the transactions from the not-confirmed pool.

1
  • 1
    Note that there is not really a single "not confirmed pool". Every node on the network keeps track of unconfirmed transactions independently. Different clients could use different algorithms to decide how long to keep them. Aug 5, 2014 at 5:35

1 Answer 1

6

In Bitcoin Core, the memory pool is a consistent set of transactions that can legally follow the best known block. As already mentioned, there is no guarantee of consistency between different nodes' mempools.

In practice that means:

  • when a new block is accepted (received from the network or locally mined), all transactions in it are removed from the mempool, while their dependencies are kept.
  • when a new block is accepted, all transactions that conflict with transactions in that block, plus all their dependencies, are removed from the mempool.
  • when a block is reorganized (disconnected), its transactions are attempted to add back to the mempool in reverse order (since they may interdependent), unless they conflict with transactions already there.
3
  • Peter thanks, I think I got it: as each node receives a new block from the network or solves one by itself it removes the nodes in the block from its local memory pool of not-confirmed transactions. Aug 5, 2014 at 11:55
  • Peter tried to up vote you but I don't have enough "reputation". Are dependencies other transactions that belong to the same origin/source as ones in the new block?. Also, disconnected means "forked"? and how are conflicts created? These are new questions derived from you having provided a very thorough answer to my initial question. I wish I could up vote. Aug 5, 2014 at 12:14
  • Dependencies of X: transactions that spend an output of X. Disconnecting: if you have a chain a-b, and you switch to a fork a-c-d, b is disconnected and then c and d are connected. Conflicts are created by attempted double spending (two transactions spending the same outputs). Aug 5, 2014 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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