Show Posts - nxtter
Please login or register.

Login with username, password and session length
Advanced search  


Latest Stable Nxt Client: Nxt 1.12.2

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - nxtter

Pages: [1]
Core Development Discussion / A question regarding rollback
« on: January 17, 2018, 06:54:04 pm »
I'm trying to understand the nxt rollback mechanism.
Assuming that when a peer gets a block and understands he needs to rollback the previous one according to the correct height

On 'BlockchainProcessorImpl. java' on the method 'popOffTo(Block block)' on line 1753, the code calls for each table
This call eventually goes to 'VersionedEntityDbTable.java' to the method 'rollback(...)' which deletes all entries with height higher than the given height.

If I understood correctly, each entry on the database contains one entry per account only with a record of the highest relevant height.

In case the local db has an entry with a higher height than the given height, the entry will be deleted and updated. But this looks strange, since in such case, the local db might contain missing data.
For example:
Let's say I have 5 coins with height 10.
I get an incorrect block which increases my coins to 6 with height 12.
Then a correct block, with height 11 arrives, where there is no update to my coins; The entry will be deleted, and on the local db I will have 0 coins.

I'll be glad to get an explanation regarding this rollback mechanism and what am I missing here.

Thank you!

Pages: [1]