Fix remove support bug #53

Merged
kaykurokawa merged 1 commit from fix_removesupport_bug_2 into master 2016-11-11 02:18:10 +01:00
kaykurokawa commented 2016-11-01 21:13:26 +01:00 (Migrated from github.com)

This is a redo of https://github.com/lbryio/lbrycrd/pull/45, containing only the fix and not the test which is contained in https://github.com/lbryio/lbrycrd/pull/52

Fixing below exception that would occurs, when decrementing block and calling function "removeSupportFromMap" to undo a support which has been spent on a txin that is NOT txin[0]

lbrycrdd: claimtrie.cpp:2294: bool CClaimTrieCache::decrementBlock(insertUndoType&, claimQueueRowType&, insertUndoType&, supportQueueRowType&, std::vectorstd::pair<std::basic_string<char, int> >&) const: Assertion `removeSupportFromMap(itSupportUndo->name, itSupportUndo->outPoint, support, false)' failed.

Essentially, the bug caused spent supports to not be undoable. Thus when decrementing a block where a support is spent, the support would still be spent when it should be unspent. When decrementing the block where that support was created, the removeSupportFromMap function would fail because the support its looking to remove is not there.

With this change, clients must run -reindex once to fix the claimtrie.

To verify the patch is working, running ./lbrycrd-cli verifychain 4 0 , should not cause an exception and return true. If not patched, running the command, will cause lbrycrdd to throw the above exception.

This is a redo of https://github.com/lbryio/lbrycrd/pull/45, containing only the fix and not the test which is contained in https://github.com/lbryio/lbrycrd/pull/52 Fixing below exception that would occurs, when decrementing block and calling function "removeSupportFromMap" to undo a support which has been spent on a txin that is NOT txin[0] lbrycrdd: claimtrie.cpp:2294: bool CClaimTrieCache::decrementBlock(insertUndoType&, claimQueueRowType&, insertUndoType&, supportQueueRowType&, std::vectorstd::pair<std::basic_string<char, int> >&) const: Assertion `removeSupportFromMap(itSupportUndo->name, itSupportUndo->outPoint, support, false)' failed. Essentially, the bug caused spent supports to not be undoable. Thus when decrementing a block where a support is spent, the support would still be spent when it should be unspent. When decrementing the block where that support was created, the removeSupportFromMap function would fail because the support its looking to remove is not there. With this change, clients must run -reindex once to fix the claimtrie. To verify the patch is working, running ./lbrycrd-cli verifychain 4 0 , should not cause an exception and return true. If not patched, running the command, will cause lbrycrdd to throw the above exception.
jobevers (Migrated from github.com) reviewed 2016-11-07 17:14:30 +01:00
jobevers (Migrated from github.com) commented 2016-11-07 17:14:30 +01:00

nit: remover should be removed

nit: `remover` should be `removed`
jobevers commented 2016-11-07 17:14:44 +01:00 (Migrated from github.com)

one type, otherwise LGTM

one type, otherwise LGTM
kaykurokawa commented 2016-11-11 02:18:06 +01:00 (Migrated from github.com)

Fixed spelling mistake, rebased , and merged

Fixed spelling mistake, rebased , and merged
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbrycrd#53
No description provided.