ltonetwork / lto-public-chain

Public blockchain designed for notary type transactions
Apache License 2.0
26 stars 4 forks source link

Improve checkpoints for resolving forks #141

Closed jasny closed 2 years ago

jasny commented 2 years ago

A checkpoint is a set of block height and signature combinations. While processing blocks, a block at the height of a checkpoint that doesn't match the checkpoint's signature, will be considered invalid and discarded.

Checkpoints do not work for blocks that are already processed and therefore can't properly resolve a fork.

Checkpoints are be broadcasted to all nodes. The checkpoint needs to be signed by the public key that's configured as checkpoints.public-key. While powerful, it gives centralized control over nodes.


Checkpoints should be in the configuration instead. In case of a fork, changing the config / updating the docker container will be required.

Nodes should check the checkpoints at startup for blocks it has already processed. In case there's a mismatch between the block signature and checkpoint signature, the node should attempt to rollback. If a rollback isn't possible, because it's passed the threshold, the node should log a message and halt.