Problem: a valid transaction is detected as double spend#2389
Merged
kansi merged 1 commit intobigchaindb:masterfrom Jul 18, 2018
Merged
Problem: a valid transaction is detected as double spend#2389kansi merged 1 commit intobigchaindb:masterfrom
kansi merged 1 commit intobigchaindb:masterfrom
Conversation
Solution: query the wanted data per input
Codecov Report
@@ Coverage Diff @@
## master #2389 +/- ##
=========================================
+ Coverage 86.9% 86.9% +<.01%
=========================================
Files 38 38
Lines 2168 2169 +1
=========================================
+ Hits 1884 1885 +1
Misses 284 284 |
kansi
approved these changes
Jul 17, 2018
Contributor
|
Some notes: A test got skipped while we were doing Tendermint integration, then we changed how a certain query worked, and the new code had a bug, but it didn't get detected because the test was skipped. When we turned on the test again, the bug was caught. This PR fixes the query (and the associated test). The bug will say (incorrectly) that certain valid transactions are invalid (double spends), in complex situations. That is annoying, but not as bad as invalid transactions being considered valid. |
16 tasks
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solution: query the wanted data per input
see #1271
To add more details:
In the test we have 5 transactions, one create and 4 transfer. In the first 4 transaction Bob only receives tokens and in the fifth he wants to spend the first two tokens he got.
When validating the fifth transaction in the query we check if the
transaction_idand theoutputare ininputs. Theinputscontains twoinputs, one that matches thetransaction_idand the other one that matches theoutput, thus we found a match and the fifth transaction is a double spend.Which it is obviously not.
So @kansi and me changed the query accordingly and we now match the
transaction_idand theoutputfor everyinputininputs.I needed to skip the other tests in this file, they're not related to this issue and should be activated separately (related to #2381)