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

fix: correct handling of collateral outputs for invalid transactions #77

Merged
merged 2 commits into from Sep 1, 2022

Conversation

jmhrpr
Copy link
Member

@jmhrpr jmhrpr commented Sep 1, 2022

The current implementation processes the transaction outputs of an invalid transaction which means we can spoof balance of an address by creating an invalid transaction which sends that address funds as a txout, because these funds will be added to the address balance but actually this txout was was never created as the tx is invalid.

In this fix the collateral inputs are processed for invalid transactions as before, but now we do not process the txouts and instead check if there is a collateral return output (Babbage only) and if so we process that output as we would a normal txout.

Note that the txin of the collateral return output UTXO is defined in the ledger specification as txhash:idx where idx is the number of transaction outputs the tx has (in other words we create a UTXO in the next available index so as to not confuse with the normal transaction outputs which were not created): let idx = tx.outputs().len();

@scarmuega
Copy link
Member

nice!

@scarmuega scarmuega merged commit cdc9d3d into txpipe:main Sep 1, 2022
@jmhrpr jmhrpr deleted the fix/handle-collateral-returns branch September 1, 2022 18:12
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.

None yet

2 participants