LayerTwo-Labs / sidesail

A work-in-progress sidechain UI.
MIT License
6 stars 4 forks source link

drivechain-server: be smarter about balance fetching #228

Closed torkelrogstad closed 1 week ago

torkelrogstad commented 1 week ago

In the GetBalance-endpoint we're currently shelling out to bdk-cli.

https://github.com/LayerTwo-Labs/sidesail/blob/39455afc68f6cd4587dee683ea7e5a2c99616b3d/drivechain-server/server/server.go#L178-L189

At the same time, we're also doing a sync+balance fetch loop in main.go:

https://github.com/LayerTwo-Labs/sidesail/blob/731279b76543c7a0760c278ae9387d03bfd6a899/drivechain-server/main.go#L101-L126

We should move the sync + balance fetch loop into the RPC server, and in the GetBalance-endpoint return the most recently fetched balance