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

Query P2P in order to determine if an input is spent later on #689

Merged

Conversation

bchamagne
Copy link
Member

Description

When retrieving the inputs of an address, we compare them to the inputs of the latest transaction of the address.
If an input has a match (the same (token, from)) in the last transaction, that input is unspent. If there is no match for an input, it means it has been spent.

Fixes #627

Type of change

  • Bug fix

How Has This Been Tested?

This has been tested via integration tests and with the following scenario on the explorer:

  1. Bastien creates a CC token
  2. Bastien creates a DD token
    Screenshot_2022-11-16_14-21-38
  3. Bastien transfers some DD token to Hamza
    Screenshot_2022-11-16_14-21-49

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

we query the last transaction and check if the utxo is still there
if it is, it means the utxo has not been spent
@samuelmanzanera samuelmanzanera merged commit 406930c into archethic-foundation:develop Nov 16, 2022
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.

Determines whether transaction input is spent from the last transaction in the chain
2 participants