Skip to content

Problem: a valid transaction is detected as double spend#2389

Merged
kansi merged 1 commit intobigchaindb:masterfrom
codegeschrei:get-spent-bug
Jul 18, 2018
Merged

Problem: a valid transaction is detected as double spend#2389
kansi merged 1 commit intobigchaindb:masterfrom
codegeschrei:get-spent-bug

Conversation

@codegeschrei
Copy link
Copy Markdown
Contributor

@codegeschrei codegeschrei commented Jul 17, 2018

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_id and the output are in inputs. The inputs contains two inputs, one that matches the transaction_id and the other one that matches the output, 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_id and the output for every input in inputs.

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)

Solution: query the wanted data per input
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 17, 2018

Codecov Report

Merging #2389 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff            @@
##           master   #2389      +/-   ##
=========================================
+ Coverage    86.9%   86.9%   +<.01%     
=========================================
  Files          38      38              
  Lines        2168    2169       +1     
=========================================
+ Hits         1884    1885       +1     
  Misses        284     284

@ttmc
Copy link
Copy Markdown
Contributor

ttmc commented Jul 17, 2018

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.

@kansi kansi mentioned this pull request Jul 17, 2018
16 tasks
@kansi kansi merged commit d521a00 into bigchaindb:master Jul 18, 2018
@kansi kansi mentioned this pull request Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants