talaia-labs / rust-teos

The Eye of Satoshi - Lightning Watchtower
https://talaia-labs.github.io/talaia.watch/
MIT License
135 stars 63 forks source link

Adds the gRPC server to the tower (InternalAPI) #6

Closed sr-gi closed 2 years ago

sr-gi commented 2 years ago

Adds the InternalAPI, a gRPC server that interfaces with the tower internals.

The InternalAPI is the only endpoint to send data to the tower, it has two main interfaces, the public and the private.

The public interface is reachable by users via any tower client, and contains the functionality required to register and send/retrieve appointments to/from the tower.

The private interface is reachable by the tower admin via the gRPC client (teos-cli) and contains functionality to manage and interact with the tower from an admin perspective.

The major change w.r.t the existing codebase is that the main components are not Arc/Mutex instead of Rc/RefCell given the gRPC server introduces a new thread, so components need to be safely shared between threads.

Some minor changes include how Appointments are created. Locators are now passed build as Locator structs instead of raw data. This minimizes the boilerplate when encoding / decoding appointments by the gRPC server but also by the DBM.