Fix mempool packages #6715

Merged
merged 2 commits into from Sep 24, 2015

Conversation

Projects
None yet
5 participants
@sdaftuar
Member

sdaftuar commented Sep 23, 2015

This fixes an edge case (introduced by #6654 and reported by @sipa here: #6654 (comment)) in removing an entry from the mempool during the middle of a reorg, where the entry has an in-block ancestor which has not yet had its descendant state updated for the transaction being removed.

The first commit updates the mempool_packages.py rpc-test to include a test that demonstrates the bug; the second commit provides a fix.

@laanwj laanwj added the Bug label Sep 23, 2015

sdaftuar added some commits Sep 23, 2015

Fix mempool package tracking edge case
CalculateMemPoolAncestors was always looping over a transaction's inputs
to find in-mempool parents.  When adding a new transaction, this is the
correct behavior, but when removing a transaction, we want to use the
ancestor set that would be calculated by walking mapLinks (which should
in general be the same set, except during a reorg when the mempool is
in an inconsistent state, and the mapLinks-based calculation would be the
correct one).
@morcos

This comment has been minimized.

Show comment
Hide comment
@morcos

morcos Sep 23, 2015

Member

ACK

Member

morcos commented Sep 23, 2015

ACK

@btcdrak

This comment has been minimized.

Show comment
Hide comment
@btcdrak

btcdrak Sep 23, 2015

Member

utACK

Member

btcdrak commented Sep 23, 2015

utACK

@0x9F

This comment has been minimized.

Show comment
Hide comment
@0x9F

0x9F Sep 24, 2015

Tested. Passes in a previously crashing situation.

0x9F commented Sep 24, 2015

Tested. Passes in a previously crashing situation.

@laanwj laanwj merged commit 60de0d5 into bitcoin:master Sep 24, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Sep 24, 2015

Merge pull request #6715
60de0d5 Fix mempool package tracking edge case (Suhas Daftuar)
598b25d Add test showing bug in mempool packages (Suhas Daftuar)
@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Sep 24, 2015

Member

utACK

Member

laanwj commented Sep 24, 2015

utACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment