Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation trusts the value in a spend without confirming it matches the spent outputid #648

Closed
bobg opened this issue Mar 1, 2017 · 0 comments
Assignees

Comments

@bobg
Copy link
Contributor

bobg commented Mar 1, 2017

We used to compute an unspent ID from the values in a spend's prevout "output commitment" and then check it existed in in the state tree. We lost that when we converted to entry-based hashing:

b817512#diff-fb46f84aaf51fdc47bacd0fb932c9f26

Now there's no separate UnspentID; the value in the state tree is simply the outputID in the spend. But that outputID needs to be recomputed from the other values in the spend (according to the txgraph mapping algorithm) and the recomputed value must match the spentOutputID in the spend for the spend to be valid. As it is, we're just reading and trusting the spentOutputID.

@bobg bobg added the bug label Mar 1, 2017
@jbowens jbowens added the 1.2 label Mar 3, 2017
iampogo pushed a commit that referenced this issue Mar 3, 2017
Spend TxInputs need to contain all of the data necessary to reconstruct
output ids in order to spend them. Performing the hashing during
validation gives us cryptographic integrity that the spent output data
is correct.

In order to preserve this data, the mapping process was updated to
return additional information which is stored in the account_utxos
table. This data is then populated in a SpendCommitment type on the
TxInput structs.

Fixes #648

Closes #665
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants