Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the ticket database with an efficient, atomic implementation
The legacy ticket database, which was GOB serialized and stored on shut down, has been removed. Ticket state information is now held in a stake node, which acts as a modularized "black box" to contain all information about the state of the stake system. Stake nodes are now a component of the blockchain blockNode struct, and are updated with them. Stake nodes, like their internal treap primitives, are immutable objects that are created with their connect and disconnect node functions. The blockchain database now stores all information about the stake state of the best node in the block database. The blockchain makes the assumption that the stake state of the best node is known at any given time. If the states of former blocks or sidechains must be evaluated, this can be achieved by iterating backwards along the blockchain from the best node, and then connecting stake nodes iteratively if necessary. Performance improvements with this new module are dramatic. The long delays on start up and shut down are removed. Blockchain synchronization time is improved approximately 5-10x on the mainnet chain. The state of the database is atomic, so unexpected shut downs should no longer have the ability to disrupt the chain state. An upgrade path has been added for version 1 blockchain databases. Users with this blockchain database will automatically update when they start their clients.
- Loading branch information