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 invalid movement when transactoin send funds to itself #597

Merged

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented Sep 29, 2022

Description

Fixes an issue when a transaction send funds to itself. If a node try to do a self repair including this transaction, an invalid_transaction_movement appear.
Error is raised because the last transaction address at a specific date return the address if the timestamp is < or = and so the transaction is validated in first as the last address at this time is thre previous transaction of the chain, but during the self repair, the last transaction at this time is the transaction itself.

So to fix this, the last transaction address at specific date returns do not return timestamp == date

Also fix the spent? flag on UTXO when the transaction is already spent

Fixes #594

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Start a node -> faucet to an address
Send a transaction to itself
The unspent output of the previous address should be spent
Start a second node and the self repair should pass normaly

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

@Neylix Neylix changed the base branch from master to develop September 29, 2022 16:28
@Neylix Neylix removed the request for review from apoorv-2204 October 4, 2022 08:08
@samuelmanzanera samuelmanzanera merged commit e20afcc into archethic-foundation:develop Oct 4, 2022
@Neylix Neylix deleted the Fix-invalid-movement branch October 5, 2022 16:04
@samuelmanzanera samuelmanzanera added the bug Something isn't working label Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid transaction movement during self repair
2 participants