Order transactions from the same block correctly
authorJerzy Kozera <jerzy.kozera@gmail.com>
Sun, 14 Apr 2013 22:20:56 +0000 (00:20 +0200)
committerJerzy Kozera <jerzy.kozera@gmail.com>
Sun, 14 Apr 2013 22:20:56 +0000 (00:20 +0200)
commitdd9d39b57d59a25755ab51b8e0cda32535c3d3a5
tree503be9497a23461ccc63cec41d3b9bf4ba626d6f
parent307de092f23443631fc10dc0443fc5c56dda643d
Order transactions from the same block correctly

Currently transactions are stored in reversed order if they belong to the same block, which can result in holes in history when pruning.

For example, consider a transaction chain A->B->C->D, where A,B,C belong to the same block, and D to the next block. It's stored in the history as C,B,A,D. So when C is pruned first, we have B,A,D in history, which results in incorrect balance calculations, because both A and D are considered to come from pruned outputs.

Storing transactions in A,B,C,D order, and then pruning A first, correctly results in only B being considered as coming from pruned output.
backends/bitcoind/blockchain_processor.py