talaia-labs / rust-teos

The Eye of Satoshi - Lightning Watchtower
https://talaia.watch
MIT License
128 stars 62 forks source link

teosd may not be able to bootstrap in pruned mode if the chain is far ahead #209

Closed sr-gi closed 1 year ago

sr-gi commented 1 year ago

Bootstrapping a tower with existing data that has fallen far behind the current chain tip in pruned mode raises an error when fetching block data. This is due to the tower querying the backend about already pruned blocks.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BlockSourceError { kind: Transient, error: Custom { kind: Other, error: "Block not available (pruned data)" } }', teos/src/main.rs:51:65
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

We should add a flag to bypass this if necessary, making the tower bootstrap from the current tip or from a block with existing data. Notice this may be unsafe, given the tower will be missing some transitions, but if it has fallen far behind some of the triggers may already have expired.