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

Update last transaction address only if timestamp is greater #717

Conversation

tenmoves
Copy link
Contributor

Description

Actually there is 2 way to set the last address for a chain

from the replication
from the notification of a last address
In both way, if the current last address in the DB has a greater timestamp than the one received, the last address is replaced by the new one. Which is not correct.

before setting the new last address, we should control that the new timestamp is greater than the one already stored

Fixes #712

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

I tested 2 cases:

  • we should not update last transaction only if timestamp is lesser
  • we should update last transaction if timestamp is greater

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

@tenmoves tenmoves added bug Something isn't working DB Involve database labels Nov 25, 2022
@tenmoves tenmoves self-assigned this Nov 25, 2022
@samuelmanzanera samuelmanzanera added the core team Assigned to the core team label Nov 28, 2022
@Neylix Neylix merged commit 18de963 into archethic-foundation:develop Nov 28, 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 core team Assigned to the core team DB Involve database
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update last transaction address only if the timestamp is greater
3 participants