Skip to content

Conversation

@jmhrpr
Copy link
Contributor

@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();

@jmhrpr jmhrpr requested a review from scarmuega as a code owner September 1, 2022 11:46
@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.

2 participants