tdex-network / tdex-daemon-alpha

💰 Alpha Daemon implementation to run automated market making strategies on top of TDEX
MIT License
0 stars 2 forks source link

Use local cache for fethcing utxos #22

Closed tiero closed 4 years ago

tiero commented 4 years ago

Even without support for concurrent requests #15 it's kind of wasteful to synchronously fetch utxos from the explorer via network request over public internet every time for responding to a client request like Balances or TradePropose RPC.

We should spin up a crawler that on a recurrent interval will fetch utxos and store into the unspesnts collection. It should follow the block time interval for liquid net (every 1-2 minutes) and be more frequent in regtest.

Only if the read from the db fails (database corruption or whatever) we should failover to the network request.