Open maurolacy opened 3 months ago
@KonradStaniec commented on 2023-04-12:
just one note here, the easiest way to trim forks is for our light client to store only main chain and remove headers when doing reorg, this way main schema does not need to change at all.
Algorithm becomes:
receive newfork
travel from current tip to common ancestor of newfork and current fork. While traveling to common ancestor register hashes and height of seen headers
Check that newfork have better total difficulty than current fork
if newfork is indeed better:
a. remove all seen headers and heights
b. store headers and heights of newfork
- if not, reject newfork.
@SebastianElvis commented on 2023-04-12:
That's a smart idea! This way we can trim forks while handling new headers in the IBC packet. Will implement.
@SebastianElvis cloned issue babylonchain/babylon-contract#14 on 2023-04-12: